Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds '--declaration-list' option #8

Merged
merged 1 commit into from
Sep 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Options:

--comments <value> Comments to keep: exclamation (default), first-exclamation or none
--debug [level] Output intermediate state of CSS during compression
--declaration-list Treats input as declaration list
-h, --help Output usage information
-i, --input <filename> Input file
--input-map <source> Input source map: none, auto (default) or <filename>
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ var command = cli.create('csso', '[input] [output]')
.option('-u, --usage <filename>', 'Usage data file')
.option('--input-map <source>', 'Input source map: none, auto (default) or <filename>', 'auto')
.option('--restructure-off', 'Turns structure minimization off')
.option('--declaration-list', 'Treats input as declaration list')
.option('--comments <value>', 'Comments to keep: exclamation (default), first-exclamation or none', 'exclamation')
.option('--stat', 'Output statistics in stderr')
.option('--debug [level]', 'Output intermediate state of CSS during compression', debugLevel, 0)
Expand All @@ -205,6 +206,7 @@ var command = cli.create('csso', '[input] [output]')
var map = options.map;
var inputMap = options.inputMap;
var structureOptimisationOff = options.restructureOff;
var declarationList = options.declarationList;
var comments = processCommentsOption(options.comments);
var debug = options.debug;
var statistics = options.stat;
Expand Down Expand Up @@ -252,7 +254,8 @@ var command = cli.create('csso', '[input] [output]')

// main action
try {
result = csso.minify(source, {
var minifyFunc = declarationList ? csso.minifyBlock : csso.minify;
result = minifyFunc(source, {
filename: inputFile,
sourceMap: sourceMap.output,
usage: usageData,
Expand Down