1 |
|
2 | (function() {
|
3 | var CleanCSSMinifier, cleanCSS, sysPath;
|
4 |
|
5 | cleanCSS = require('clean-css');
|
6 |
|
7 | sysPath = require('path');
|
8 |
|
9 | module.exports = CleanCSSMinifier = (function() {
|
10 |
|
11 | CleanCSSMinifier.prototype.brunchPlugin = true;
|
12 |
|
13 | CleanCSSMinifier.prototype.type = 'stylesheet';
|
14 |
|
15 | function CleanCSSMinifier(config) {
|
16 | this.config = config;
|
17 | null;
|
18 | }
|
19 |
|
20 | CleanCSSMinifier.prototype.minify = function(data, path, callback) {
|
21 | var error, minified;
|
22 | try {
|
23 | minified = cleanCSS.process(data);
|
24 | } catch (err) {
|
25 | error = "CSS minify failed on " + path + ": " + error;
|
26 | }
|
27 | return process.nextTick(function() {
|
28 | return callback(error, minified || data);
|
29 | });
|
30 | };
|
31 |
|
32 | return CleanCSSMinifier;
|
33 |
|
34 | })();
|
35 |
|
36 | }).call(this);
|