🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

lighting-plugin-less

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lighting-plugin-less - npm Package Compare versions

Comparing version
1.0.4
to
1.0.5
+16
-18
index.js

@@ -12,23 +12,21 @@ var less = require("less");

prepare:function (light,cb) {
var files = light.util.glob.sync("dist/**/*.less");
var filesLength = files.length;
if(filesLength==0) return cb();
let files = light.util.glob.sync("dist/**/*.less"),
processPromise = [];
files.forEach(function (file) {
var str = light.util.readFileSync(file).toString();
processPromise.push(new Promise(function (resolve, reject) {
less.render(light.util.readFileSync(file).toString(),{
path: light.util.parse(file).dir
}, function(err, result) {
light.util.writeFileSync(file.replace(/less$/i,"css"),result.css);
resolve()
});
}));
});
less.render(str,{
paths:light.util.parse(file).dir
}, function(e, r) {
filesLength--;
if(!e){
light.util.writeFileSync(file,r.css);
light.util.renameSync(file,file.replace(/less$/i,"css"));
}else{
light.util.log("error","less插件执行错误:"+e);
}
if(filesLength==0) cb();
});
})
Promise.all(processPromise).then(function () {
light.util.glob.sync("dist/**/*.less").forEach(function (file) {
light.util.removeSync(file);
})
}).then(cb);
},

@@ -35,0 +33,0 @@

{
"name": "lighting-plugin-less",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",