|
@@ -13,6 +13,8 @@ require('dotenv').config();
|
|
*/
|
|
*/
|
|
const glob = require('glob')
|
|
const glob = require('glob')
|
|
|
|
|
|
|
|
+let theme = null;
|
|
|
|
+
|
|
let distPath = mix.inProduction() ? 'resources/dist' : 'resources/pre-dist';
|
|
let distPath = mix.inProduction() ? 'resources/dist' : 'resources/pre-dist';
|
|
|
|
|
|
function mixAssetsDir(query, cb) {
|
|
function mixAssetsDir(query, cb) {
|
|
@@ -22,6 +24,12 @@ function mixAssetsDir(query, cb) {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function themeCss(path) {
|
|
|
|
+ let sf = theme ? '-'+theme : '';
|
|
|
|
+
|
|
|
|
+ return `${distPath}/${path}${sf}.css`
|
|
|
|
+}
|
|
|
|
+
|
|
function dcatPath(path) {
|
|
function dcatPath(path) {
|
|
return 'resources/assets/dcat/' + path;
|
|
return 'resources/assets/dcat/' + path;
|
|
}
|
|
}
|
|
@@ -42,7 +50,7 @@ mix.copyDirectory('resources/assets/fonts', distPath + '/fonts');
|
|
mix.copyDirectory('resources/assets/vendors', distPath + '/vendors');
|
|
mix.copyDirectory('resources/assets/vendors', distPath + '/vendors');
|
|
|
|
|
|
// AdminLTE3.0
|
|
// AdminLTE3.0
|
|
-mix.sass('resources/assets/adminlte/scss/AdminLTE.scss', distPath + '/adminlte/adminlte.css').sourceMaps();
|
|
|
|
|
|
+mix.sass('resources/assets/adminlte/scss/AdminLTE.scss', themeCss('adminlte/adminlte')).sourceMaps();
|
|
mix.js('resources/assets/adminlte/js/AdminLTE.js', distPath + '/adminlte/adminlte.js').sourceMaps();
|
|
mix.js('resources/assets/adminlte/js/AdminLTE.js', distPath + '/adminlte/adminlte.js').sourceMaps();
|
|
|
|
|
|
// 复制第三方插件文件夹
|
|
// 复制第三方插件文件夹
|
|
@@ -50,8 +58,14 @@ mix.copyDirectory(dcatPath('plugins'), dcatDistPath('plugins'));
|
|
// 打包app.js
|
|
// 打包app.js
|
|
mix.js(dcatPath('js/dcat-app.js'), dcatDistPath('js/dcat-app.js')).sourceMaps();
|
|
mix.js(dcatPath('js/dcat-app.js'), dcatDistPath('js/dcat-app.js')).sourceMaps();
|
|
// 打包app.scss
|
|
// 打包app.scss
|
|
-mix.sass(dcatPath('sass/dcat-app.scss'), dcatDistPath('css/dcat-app.css')).sourceMaps();
|
|
|
|
|
|
+mix.sass(dcatPath('sass/dcat-app.scss'), themeCss('css/dcat-app')).sourceMaps();
|
|
|
|
|
|
// 打包所有 extra 里面的所有js和css
|
|
// 打包所有 extra 里面的所有js和css
|
|
mixAssetsDir('dcat/extra/*.js', (src, dest) => mix.js(src, dest));
|
|
mixAssetsDir('dcat/extra/*.js', (src, dest) => mix.js(src, dest));
|
|
-mixAssetsDir('dcat/extra/*.scss', (src, dest) => mix.sass(src, dest.replace('scss', 'css')));
|
|
|
|
|
|
+mixAssetsDir('dcat/extra/*.scss', (src, dest) => {
|
|
|
|
+ if (theme) {
|
|
|
|
+ return mix.sass(src, dest.replace('\.scss', '-'+theme+'.css'))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return mix.sass(src, dest.replace('scss', 'css'))
|
|
|
|
+});
|