Javascript 网页包缩小js并在多个子目录中编译SCS
我正试图创建一个使用webpack的构建系统,以便更好地开发PHP项目的工作流程。 源repo都被克隆到Javascript 网页包缩小js并在多个子目录中编译SCS,javascript,webpack,composer-php,Javascript,Webpack,Composer Php,我正试图创建一个使用webpack的构建系统,以便更好地开发PHP项目的工作流程。 源repo都被克隆到/vendor/目录中,但要让PHP访问,它们需要登录到/source/目录中。我的计划是在供应商目录下工作,并让webpack在文件更改时自动复制所有文件 下面的webpack.config.js可以很好地解决这个问题: module.exports = { mode: "development", entry: [], //
/vendor/
目录中,但要让PHP访问,它们需要登录到/source/
目录中。我的计划是在供应商
目录下工作,并让webpack在文件更改时自动复制所有文件
下面的webpack.config.js
可以很好地解决这个问题:
module.exports = {
mode: "development",
entry: [], // empty so far, since only the CopyPlugin does something atm
output: { path: __dirname },
plugins: [
new CopyPlugin({
patterns: [
{
from: "**/*",
to: ".",
context: "vendor/myVendor/",
transformPath(targetPath, absolutePath) {
return "source/modules/myVendor/" + targetPath;
},
globOptions: {
ignore: ["**/resources/**/*"],
},
},
],
})
],
};
如您所见,这将复制模块中不在资源文件夹中的所有文件。这就是这个问题
文件夹结构如下所示:
/vendor
/myvendor
/mymodule1 <- just one of many modules - this should work for all of them
composer.json
/Application
/Controller
TestController.php
/resources
/js/minifyme.js <- this should be processed...
/css/coolcss.sass <- ...also this one...
/out
/src
/js/minifyme.min.js <- ...and copied here
/css/coolcss.css <- ...or here, respectively
/vendor
/我的卖主
/mymodule1