csso
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -0,1 +1,6 @@ | ||
## 2.3.0 (October 25, 2016) | ||
- Added `beforeCompress` and `afterCompress` options support (#316) | ||
- Fixed crash on empty argument in function (#317) | ||
## 2.2.1 (July 25, 2016) | ||
@@ -2,0 +7,0 @@ |
@@ -63,2 +63,12 @@ var parse = require('./parser'); | ||
function runHandler(ast, options, handlers) { | ||
if (!Array.isArray(handlers)) { | ||
handlers = [handlers]; | ||
} | ||
handlers.forEach(function(fn) { | ||
fn(ast, options); | ||
}); | ||
} | ||
function minify(context, source, options) { | ||
@@ -79,2 +89,9 @@ options = options || {}; | ||
// before compress handlers | ||
if (options.beforeCompress) { | ||
debugOutput('beforeCompress', options, Date.now(), | ||
runHandler(ast, options, options.beforeCompress) | ||
); | ||
} | ||
// compress | ||
@@ -85,2 +102,9 @@ var compressResult = debugOutput('compress', options, Date.now(), | ||
// after compress handlers | ||
if (options.afterCompress) { | ||
debugOutput('afterCompress', options, Date.now(), | ||
runHandler(compressResult, options, options.afterCompress) | ||
); | ||
} | ||
// translate | ||
@@ -87,0 +111,0 @@ if (options.sourceMap) { |
@@ -1082,3 +1082,10 @@ 'use strict'; | ||
case TokenType.Comma: | ||
removeTrailingSpaces(argument.sequence); | ||
if (argument) { | ||
removeTrailingSpaces(argument.sequence); | ||
} else { | ||
args.insert(List.createItem({ | ||
type: 'Argument', | ||
sequence: new List() | ||
})); | ||
} | ||
scanner.next(); | ||
@@ -1085,0 +1092,0 @@ readSC(); |
{ | ||
"name": "csso", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "CSSO (CSS Optimizer) is a CSS minifier with structural optimisations", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -221,2 +221,4 @@ [![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso) | ||
- debug `Boolean` - output debug information to `stderr` | ||
- beforeCompress `function|array<function>` - called right after parse is run. Callbacks arguments are `ast, options`. | ||
- afterCompress `function|array<function>` - called right after compress is run. Callbacks arguments are `compressResult, options`. | ||
- other options are the same as for `compress()` | ||
@@ -223,0 +225,0 @@ |
Sorry, the diff of this file is too big to display
303623
5653
408