UNPKG

1.16 kBJavaScriptView Raw
1// Generated by CoffeeScript 1.6.3
2var CleanCSSMinifier, cleanCSS, sysPath,
3 __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
4
5cleanCSS = require('clean-css');
6
7sysPath = require('path');
8
9module.exports = CleanCSSMinifier = (function() {
10 CleanCSSMinifier.prototype.brunchPlugin = true;
11
12 CleanCSSMinifier.prototype.type = 'stylesheet';
13
14 function CleanCSSMinifier(config) {
15 var _ref, _ref1, _ref2;
16 this.config = config;
17 this.optimize = __bind(this.optimize, this);
18 this.options = (_ref = (_ref1 = this.config) != null ? (_ref2 = _ref1.plugins) != null ? _ref2.cleancss : void 0 : void 0) != null ? _ref : {};
19 }
20
21 CleanCSSMinifier.prototype.optimize = function(_arg, callback) {
22 var data, err, error, optimized, path;
23 data = _arg.data, path = _arg.path;
24 try {
25 optimized = cleanCSS.process(data, this.options);
26 } catch (_error) {
27 err = _error;
28 error = "CSS minify failed on " + path + ": " + err;
29 }
30 return process.nextTick(function() {
31 return callback(error, {
32 data: optimized || data
33 });
34 });
35 };
36
37 return CleanCSSMinifier;
38
39})();