Comparing version 0.6.0 to 0.6.1
var helper = require("../lib/util"); | ||
var less = require("less"); | ||
var path = require("path"); | ||
@@ -7,12 +8,26 @@ module.exports = function (pxcssfile, reqOpt, param, cb) { | ||
var isMap = false; | ||
if (/\.map$/.test(pxcssfile)) { | ||
isMap = true; | ||
pxcssfile = pxcssfile.replace(/\.map$/, ''); | ||
} | ||
var xcssfile = pxcssfile.replace(/(\.less)\.css$/, "$1"); | ||
var renderOpt = { | ||
paths: [], | ||
compress: false, | ||
filename: xcssfile | ||
}; | ||
if (isMap || param.sourcemap) { | ||
renderOpt.sourceMap = { | ||
sourceMapBasepath: path.dirname(pxcssfile), | ||
sourceMapURL: path.basename(pxcssfile) + ".map" | ||
}; | ||
} | ||
var lesstext = helper.getUnicode(xcssfile); | ||
if (lesstext !== null) { | ||
less.render(lesstext, { | ||
paths: [], | ||
compress: false, | ||
filename: xcssfile | ||
}, function (e, result) { | ||
less.render(lesstext, renderOpt, function (e, result) { | ||
if (!e) { | ||
cb(e, result.css, xcssfile, MIME); | ||
cb(e, (isMap ? result.map : result.css), xcssfile, (isMap ? "application/json" : MIME)); | ||
} | ||
@@ -19,0 +34,0 @@ else { |
{ | ||
"name": "dac", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Dynamic Assets Compiler", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7298
194