1 Star 0 Fork 280

WT/dcat-admin

forked from 剑走偏锋/dcat-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.mix.js 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
剑走偏锋 提交于 2020-10-14 15:40 . :construction:nunito字体本地化
const mix = require('laravel-mix');
require('dotenv').config();
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
const glob = require('glob')
let theme = null;
let distPath = mix.inProduction() ? 'resources/dist' : 'resources/pre-dist';
function mixAssetsDir(query, cb) {
(glob.sync('resources/assets/' + query) || []).forEach(f => {
f = f.replace(/[\\\/]+/g, '/');
cb(f, f.replace('resources/assets', distPath));
});
}
function themeCss(path) {
let sf = theme ? '-'+theme : '';
return `${distPath}/${path}${sf}.css`
}
function dcatPath(path) {
return 'resources/assets/dcat/' + path;
}
function dcatDistPath(path) {
return distPath + '/dcat/' + path;
}
/*
|--------------------------------------------------------------------------
| Dcat Admin assets
|--------------------------------------------------------------------------
*/
mix.copyDirectory('resources/assets/images', distPath + '/images');
mix.copyDirectory('resources/assets/fonts', distPath + '/fonts');
// AdminLTE3.0
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.copyDirectory(dcatPath('plugins'), dcatDistPath('plugins'));
// 打包app.js
mix.js(dcatPath('js/dcat-app.js'), dcatDistPath('js/dcat-app.js')).sourceMaps();
// 打包app.scss
mix.sass(dcatPath('sass/dcat-app.scss'), themeCss('dcat/css/dcat-app')).sourceMaps();
mix.copy(dcatPath('sass/nunito.css'), `${distPath}/dcat/css/nunito.css`);
// 打包所有 extra 里面的所有js和css
mixAssetsDir('dcat/extra/*.js', (src, dest) => mix.js(src, dest));
mixAssetsDir('dcat/extra/*.scss', (src, dest) => mix.sass(src, dest.replace('scss', 'css')));
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/MiRenDeWeiXiao/dcat-admin.git
git@gitee.com:MiRenDeWeiXiao/dcat-admin.git
MiRenDeWeiXiao
dcat-admin
dcat-admin
2.0

搜索帮助