Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 18, 2014
1 parent 1c2aacc commit 8f10b45
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# editorconfig.org
root = true

[*]
Expand Down
10 changes: 2 additions & 8 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 11 additions & 8 deletions cli.js
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
15 changes: 10 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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);
Expand All @@ -29,7 +31,8 @@ function getRenderedFixture(cb) {

got(url, function (err, data) {
if (err) {
return cb(err);
cb(err);
return;
}

var $ = cheerio.load(data);
Expand Down Expand Up @@ -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, {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8f10b45

Please sign in to comment.