This repository was archived by the owner on Jan 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Merged
V2 #42
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
4b433a0
Rename results
jxnblk 78204d5
Rename src
jxnblk 70bd0bd
Rename opts
jxnblk 3452aa4
Add lite option
jxnblk 355c952
Handle default behavior or use as a PostCSS plugin
jxnblk b4d98d6
Update selectors module
jxnblk a2a4edd
Adjust rules module
jxnblk 0daf9b1
Simplify declarations
jxnblk 1e2448d
Comment out lite option
jxnblk 74280ee
Count total declarations
jxnblk b9d5d10
Update tests
jxnblk 44f78ae
Use reduce for finding duplicate selectors
jxnblk b1fa8b9
Add media queries module
jxnblk 018399b
Add standard
jxnblk ae017ec
Use standard
jxnblk 3a78964
Remove unused aggregates object
jxnblk c5c3811
Remove unused modules
jxnblk 48e368f
Update README
jxnblk e3af577
Add usage examples section to readme
jxnblk 64446fd
Add all stats for each media query
jxnblk cd0add7
Pass opts to each module
jxnblk 5669b5e
First pass at lite option
jxnblk 985653a
Push media query contents to an array
jxnblk 9237f87
Specificity graph method
jxnblk 376b6c6
Get repeated selectors method
jxnblk 1b7320a
Get property resets method
jxnblk 3cd6e07
Add mediaQueries option
jxnblk 2e7650e
Add property methods
jxnblk fdf4ee4
Add sorted specificity method
jxnblk 19c4f1c
Update readme
jxnblk 5ecdf3f
Add methods to object in readme
jxnblk aca2e17
Add options for methods
jxnblk a77b8ad
Add vendor prefix method
jxnblk 13cb0a1
Add optional array of important declarations
jxnblk bd7f4a3
Remove method from json
jxnblk a52b87e
Add font size and font family methods
jxnblk 86ade75
Type selectors count
jxnblk 6372393
Use css-selector-tokenizer
jxnblk 4bf0deb
2.0.0-beta.1
jxnblk cc04080
Move specificity graph generation out of loop
jxnblk 3d64c09
2.0.0-beta.2
jxnblk d128dca
Adjust specificity graph
jxnblk 5e82d58
2.0.0-beta.3
jxnblk 00a9c1a
Provide parent argument for parsing font sizes
jxnblk a2a421e
Remove lite option
jxnblk 13bb1c6
Count max rule size
jxnblk bcc2038
Change order of selectors object
jxnblk 8242673
Update tests
jxnblk 3076b99
Fix non-standard issues
jxnblk e437723
2.0.0-beta.4
jxnblk 469fcb5
Fix typo
jxnblk 06e59b7
Edit readme
jxnblk e9d8a43
Edit title for readme
jxnblk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,43 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| var program = require('commander'); | ||
| var cssstats = require('..'); | ||
| var fs = require('fs'); | ||
| var stdin = require('stdin'); | ||
| var program = require('commander') | ||
| var cssstats = require('..') | ||
| var fs = require('fs') | ||
| var stdin = require('stdin') | ||
|
|
||
| var version = '1.6.0' | ||
|
|
||
| console.log('CSS Statistics CLI (' + version + ')'); | ||
| console.log('CSS Statistics CLI (' + version + ')') | ||
|
|
||
| program | ||
| .version(version); | ||
| .version(version) | ||
|
|
||
| program | ||
| .command('file [file]') | ||
| .description('read a local css file') | ||
| .action(function(file) { | ||
| .action(function (file) { | ||
| if (!file) { | ||
| console.log('Please specify a CSS file'); | ||
| return; | ||
| console.log('Please specify a CSS file') | ||
| return | ||
| } | ||
|
|
||
| try { | ||
| var css = fs.readFileSync(file, 'utf8'); | ||
| console.log(JSON.stringify(cssstats(css), null, 2)); | ||
| var css = fs.readFileSync(file, 'utf8') | ||
| console.log(JSON.stringify(cssstats(css), null, 2)) | ||
| } catch (e) { | ||
| console.log('CSS Statistics encountered an error reading ' + file); | ||
| console.log(e); | ||
| console.log('CSS Statistics encountered an error reading ' + file) | ||
| console.log(e) | ||
| } | ||
| }); | ||
| }) | ||
|
|
||
| program.parse(process.argv); | ||
| program.parse(process.argv) | ||
|
|
||
| if (!program.args.length) { | ||
| console.log('Input some CSS\n^C to cancel\n^D when complete'); | ||
| console.log('Input some CSS\n^C to cancel\n^D when complete') | ||
|
|
||
| stdin(function(css) { | ||
| stdin(function (css) { | ||
| if (css) { | ||
| console.log(JSON.stringify(cssstats(css), null, 2)); | ||
| console.log(JSON.stringify(cssstats(css), null, 2)) | ||
| } | ||
| }); | ||
| }) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- objectEdit: Nevermind, I see the pattern here : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any advice on a standard way of writing this out would be cool. I don't know if using something like jsdoc is still cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the current formatting. Though, I'd probably prefer to see the type for all properties:
number,object,array, etc. IMO it's pretty useful when scanning the API docs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I'll add those in. Related: does that weird fence block with the returned object make sense or is there a better way to represent that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made sense to me.