This commit is contained in:
Sindre Sorhus 2014-08-19 01:14:43 +02:00
parent 1c2aacc7ce
commit 8f10b458e8
5 changed files with 26 additions and 25 deletions

View File

@ -1,4 +1,3 @@
# editorconfig.org
root = true
[*]

View File

@ -4,16 +4,10 @@
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true
"unused": "vars",
"strict": true
}

19
cli.js
View File

@ -1,22 +1,25 @@
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var githubMarkdownCss = require('./index');
var input = process.argv[2];
var githubMarkdownCss = require('./');
var argv = process.argv.slice(2);
function help() {
console.log(pkg.description);
console.log('');
console.log('Usage');
console.log(' $ github-markdown-css > <filename>');
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' github-markdown-css > <filename>'
].join('\n'));
}
if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
if (argv.indexOf('--help') !== -1) {
help();
return;
}
if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}

View File

@ -6,7 +6,8 @@ var uncss = require('uncss');
function getCss(cb) {
got('https://github.com', function (err, data) {
if (err) {
return cb(err);
cb(err);
return;
}
var ret = [];
@ -17,7 +18,8 @@ function getCss(cb) {
});
if (ret.length === 0) {
return cb(new Error('Could not find GitHub stylesheets'));
cb(new Error('Could not find GitHub stylesheets'));
return;
}
cb(null, ret);
@ -29,7 +31,8 @@ function getRenderedFixture(cb) {
got(url, function (err, data) {
if (err) {
return cb(err);
cb(err);
return;
}
var $ = cheerio.load(data);
@ -103,12 +106,14 @@ function cleanupCss(str) {
module.exports = function (cb) {
getRenderedFixture(function (err, html) {
if (err) {
return cb(err);
cb(err);
return;
}
getCss(function (err, stylesheets) {
if (err) {
return cb(err);
cb(err);
return;
}
uncss(html, {

View File

@ -4,14 +4,14 @@
"description": "The minimal amount of CSS to replicate the GitHub Markdown style",
"license": "MIT",
"repository": "sindresorhus/github-markdown-css",
"bin": {
"github-markdown-css": "cli.js"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"github-markdown-css": "cli.js"
},
"contributors": [
{
"name": "Benjamin Tan",