v1.18.x
psychobunny 8 years ago
parent d01f099d24
commit 0e219a8c58

@ -83,7 +83,12 @@ module.exports = function (grunt) {
}, },
}, },
lessUpdated_Admin: { lessUpdated_Admin: {
files: ['public/**/*.less'], files: [
'public/*.less',
'node_modules/nodebb-*/*.less', 'node_modules/nodebb-*/**/*.less',
'!node_modules/nodebb-*/node_modules/**',
'!node_modules/nodebb-*/.git/**',
],
options: { options: {
interval: 1000, interval: 1000,
}, },

@ -118,6 +118,20 @@ function getBundleMetadata(target, callback) {
}, },
], cb); ], cb);
}, },
acpLess: function (cb) {
if (target === 'client') {
return cb(null, '');
}
async.waterfall([
function (next) {
filterMissingFiles(plugins.acpLessFiles, next);
},
function (acpLessFiles, next) {
getImports(acpLessFiles, '\n@import ".', '.less', next);
},
], cb);
},
css: function (cb) { css: function (cb) {
async.waterfall([ async.waterfall([
function (next) { function (next) {
@ -133,8 +147,9 @@ function getBundleMetadata(target, callback) {
function (result, next) { function (result, next) {
var cssImports = result.css; var cssImports = result.css;
var lessImports = result.less; var lessImports = result.less;
var acpLessImports = result.acpLess;
var imports = cssImports + '\n' + lessImports; var imports = cssImports + '\n' + lessImports + '\n' + acpLessImports;
imports = buildImports[target](imports); imports = buildImports[target](imports);
next(null, { paths: paths, imports: imports }); next(null, { paths: paths, imports: imports });

@ -30,6 +30,7 @@ Plugins.loadedHooks = {};
Plugins.staticDirs = {}; Plugins.staticDirs = {};
Plugins.cssFiles = []; Plugins.cssFiles = [];
Plugins.lessFiles = []; Plugins.lessFiles = [];
Plugins.acpLessFiles = [];
Plugins.clientScripts = []; Plugins.clientScripts = [];
Plugins.acpScripts = []; Plugins.acpScripts = [];
Plugins.libraryPaths = []; Plugins.libraryPaths = [];
@ -83,6 +84,7 @@ Plugins.reload = function (callback) {
Plugins.versionWarning = []; Plugins.versionWarning = [];
Plugins.cssFiles.length = 0; Plugins.cssFiles.length = 0;
Plugins.lessFiles.length = 0; Plugins.lessFiles.length = 0;
Plugins.acpLessFiles.length = 0;
Plugins.clientScripts.length = 0; Plugins.clientScripts.length = 0;
Plugins.acpScripts.length = 0; Plugins.acpScripts.length = 0;
Plugins.libraryPaths.length = 0; Plugins.libraryPaths.length = 0;

@ -25,6 +25,9 @@ module.exports = function (Plugins) {
lessFiles: function (next) { lessFiles: function (next) {
Plugins.data.getFiles(pluginData, 'less', next); Plugins.data.getFiles(pluginData, 'less', next);
}, },
acpLessFiles: function (next) {
Plugins.data.getFiles(pluginData, 'acpLess', next);
},
clientScripts: function (next) { clientScripts: function (next) {
Plugins.data.getScripts(pluginData, 'client', next); Plugins.data.getScripts(pluginData, 'client', next);
}, },
@ -60,6 +63,7 @@ module.exports = function (Plugins) {
Object.assign(Plugins.staticDirs, results.staticDirs || {}); Object.assign(Plugins.staticDirs, results.staticDirs || {});
add(Plugins.cssFiles, results.cssFiles); add(Plugins.cssFiles, results.cssFiles);
add(Plugins.lessFiles, results.lessFiles); add(Plugins.lessFiles, results.lessFiles);
add(Plugins.acpLessFiles, results.acpLessFiles);
add(Plugins.clientScripts, results.clientScripts); add(Plugins.clientScripts, results.clientScripts);
add(Plugins.acpScripts, results.acpScripts); add(Plugins.acpScripts, results.acpScripts);
Object.assign(meta.js.scripts.modules, results.modules || {}); Object.assign(meta.js.scripts.modules, results.modules || {});
@ -79,6 +83,7 @@ module.exports = function (Plugins) {
Plugins.prepareForBuild = function (targets, callback) { Plugins.prepareForBuild = function (targets, callback) {
Plugins.cssFiles.length = 0; Plugins.cssFiles.length = 0;
Plugins.lessFiles.length = 0; Plugins.lessFiles.length = 0;
Plugins.acpLessFiles.length = 0;
Plugins.clientScripts.length = 0; Plugins.clientScripts.length = 0;
Plugins.acpScripts.length = 0; Plugins.acpScripts.length = 0;
Plugins.soundpacks.length = 0; Plugins.soundpacks.length = 0;
@ -91,7 +96,7 @@ module.exports = function (Plugins) {
'client js bundle': ['clientScripts'], 'client js bundle': ['clientScripts'],
'admin js bundle': ['acpScripts'], 'admin js bundle': ['acpScripts'],
'client side styles': ['cssFiles', 'lessFiles'], 'client side styles': ['cssFiles', 'lessFiles'],
'admin control panel styles': ['cssFiles', 'lessFiles'], 'admin control panel styles': ['cssFiles', 'lessFiles', 'acpLessFiles'],
sounds: ['soundpack'], sounds: ['soundpack'],
languages: ['languageData'], languages: ['languageData'],
}; };

Loading…
Cancel
Save