在根目录下 plugins.mix.js 文件
let mix = require('laravel-mix');
function public_path($path){
if($path){
return "./public/"+$path;
}else{
return "./public"
}
}
function resources_path($path){
if($path){
return "./resources/"+$path;
}else{
return "./resources"
}
}
// 举例子
mix.sass(resources_path("sass/plugins/Topic/app.scss"),"plugins/Topic/css").version();
// 设置public目录
mix.setPublicPath(public_path());
mix.setResourceRoot(resources_path());
如果要把/resources/js/plugins/Core/admin.js 编译到/public/plugins/Core/js/admin.js
需要在此文件里加上这一段代码:
mix.js(resources_path("sass/plugins/Core/admin.js"),"plugins/Core/js/admin.js").version();
如果要把/resources/sass/plugins/Topic/app.scss 编译到 /public/plugins/Topic/css/app.css
需要在此文件加上这一段代码:
mix.sass(resources_path("sass/plugins/Topic/app.scss"),"plugins/Topic/css").version();
开发者命令
打包资源至插件目录
php CodeFec CodeFec:AllRm
运行此命令后,会将/resources/js/plugins 、/resources/js/themes、/resources/sass/plugins、/resources/sass/themes 、/public/plugins、/public/themes 目录下的资源分发到各个插件资源包内
从插件内分发资源
php CodeFec CodeFec:MigratePackage
跟 php CodeFec CodeFec:AllRm
命令相反,它是把插件里的静态资源复制到主程序上(/resources 目录下)
发表 :2年前 | 修改过
成功了,多谢