feat: update LESS to v3.x, #7855 (#7867)

* feat: #7855

* fix: tests
This commit is contained in:
Barış Soner Uşaklı
2019-08-28 11:22:39 -04:00
committed by GitHub
parent 105fb79c5b
commit aea04de094
4 changed files with 8 additions and 2 deletions

View File

@@ -67,7 +67,7 @@
"jsesc": "2.5.2",
"json-2-csv": "^3.0.0",
"jsonwebtoken": "^8.4.0",
"less": "^2.7.3",
"less": "^3.10.3",
"lodash": "^4.17.15",
"logrotate-stream": "^0.2.5",
"lru-cache": "5.1.1",

View File

@@ -119,6 +119,7 @@ function lessRender(string, callback) {
var less = require('less');
less.render(string, {
compress: true,
javascriptEnabled: true,
}, callback);
}

View File

@@ -268,6 +268,7 @@ Minifier.js.minifyBatch = function (scripts, fork, callback) {
function buildCSS(data, callback) {
less.render(data.source, {
paths: data.paths,
javascriptEnabled: true,
}, function (err, lessOutput) {
if (err) {
return callback(err);

View File

@@ -183,7 +183,11 @@ describe('Build', function (done) {
var filename = path.join(__dirname, '../build/public/admin.css');
assert(file.existsSync(filename));
var adminCSS = fs.readFileSync(filename).toString();
assert(adminCSS.startsWith('@charset "UTF-8";') || adminCSS.startsWith('@import url'));
if (global.env === 'production') {
assert(adminCSS.startsWith('@charset "UTF-8";') || adminCSS.startsWith('@import url'));
} else {
assert(adminCSS.startsWith('.recent-replies'));
}
done();
});
});