Permalink
Browse files

Expose cssCompressor and jsCompressor functions of mincer

  • Loading branch information...
1 parent 9bb72b5 commit 8be89d6e279bb6589b7324c0500514981048a578 @vadimi vadimi committed Dec 19, 2013
Showing with 18 additions and 0 deletions.
  1. +8 −0 README.md
  2. +8 −0 tasks/lib/mince.js
  3. +2 −0 tasks/mincer.js
View
@@ -70,6 +70,14 @@ for faster access to assets. Check out [mincer documentation](http://nodeca.gith
for more information about manifest usafe. If `manifestPath` is set assets are compiled into manifest
directory, `dest` and `destDir` parameters are ignored.
+#### jsCompressor ```string|function(context, data)```
+
+JavaScript compression function or predefined `mincer` js compressor identifier `"uglify"`. If predefined identifier is used - `uglify-js` package needs to be installed. Check out [mincer jsCompressor documentation](http://nodeca.github.io/mincer/#Compressing.prototype.jsCompressor) for more details.
+
+#### cssCompressor ```string|function(context, data)```
+
+CSS compression function or predefined `mincer` css compressor identifier `"csso"`. If predefined identifier is used - `csso` package needs to be installed. Check out [mincer cssCompressor documentation](http://nodeca.github.io/mincer/#Compressing.prototype.cssCompressor) for more details.
+
### Config Examples
There are couple of formats you can use to configure mincer task.
View
@@ -44,6 +44,14 @@ exports.init = function (grunt) {
return;
}
+ if (options.jsCompressor) {
+ environment.jsCompressor = options.jsCompressor;
+ }
+
+ if (options.cssCompressor) {
+ environment.cssCompressor = options.cssCompressor;
+ }
+
if (options.manifestPath && options.manifestPath.length > 0) {
var manifest = new Mincer.Manifest(environment, options.manifestPath);
manifest.compile([options.src], function (err) {
View
@@ -26,6 +26,8 @@ module.exports = function (grunt) {
src: options.src || this.target + '.js',
helpers: options.helpers || {},
engines: options.engines || {},
+ jsCompressor: options.jsCompressor || null,
+ cssCompressor: options.cssCompressor || null,
configure: options.configure || function () {},
dest: options.dest || path.join(options.destDir, this.target + '.js')
};

0 comments on commit 8be89d6

Please sign in to comment.