Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/assets/js/jquery-terminal/scripts/cssnano.js
1293 views
1
var fs = require('fs');
2
var nano = require('cssnano');
3
4
var input = process.argv[2];
5
var output = process.argv[3];
6
7
var options = {
8
preset: "default",
9
map: {
10
inline: false
11
},
12
discardUnused: false,
13
from: input,
14
to: output
15
};
16
17
function error(err) {
18
if (err) {
19
if (err.message && typeof err.showSourceCode === 'function') {
20
console.error(err.message);
21
console.error(err.showSourceCode());
22
} else {
23
console.error(err);
24
}
25
process.exit(1);
26
}
27
}
28
29
fs.readFile(input, function(err, buffer) {
30
nano.process(String(buffer), options).then(function(result) {
31
fs.writeFile(output, result.css, function(err) {
32
error(err);
33
fs.writeFile(output + '.map', result.map.toString(), error);
34
});
35
}).catch(error);
36
});
37
38