简体   繁体   English

使用Laravel Elixir在Gulp中编译资产子目录

[英]Compiling assets subdirectories in Gulp with Laravel Elixir

I am working on what will end up being a very large application, which means my asssets/whatever folders are going to contain possibly a few hundred files (SCSS, js etc). 我正在研究最终将是一个很大的应用程序,这意味着我的资产/任何文件夹可能包含数百个文件(SCSS,js等)。

Obviously this will make managing them a little tricky, so I would like to arrange them into subfolders for each module of my application. 显然,这会使管理它们变得有些棘手,因此我想将它们放在应用程序每个模块的子文件夹中。

eg The SAP part of my application would have its style and js stored like the following: 例如,我的应用程序的SAP部分将按照以下方式存储其样式和js:

resources/assets/js/SAP/myjs.js resources/assets/sass/SAP/mysass.scss 资源/资产/js/SAP/myjs.js资源/资产/sass/SAP/mysass.scss

It looks like in laravel-elixars config that you can only specify one assetsDir path: 在laravel-elixars配置中,您只能指定一个assetsDir路径:

var config = {
    production: !! util.env.production,
    srcDir: 'app',
    assetsDir: 'resources/assets/',
    cssOutput: 'public/css/_raw',
    jsOutput: 'public/js/_raw',
    bowerDir: 'vendor/bower_components',
    tasks: [],
    watchers: { default: {} },
    duplicate: [],
    concatenate: { css: [], js: [] }
};

It would be good if you could at least do the following: 如果您至少可以执行以下操作,那将是很好的:

...
assetsDir: ['resources/assets/SAP', 'resources/assets/Diary', ...],
...

Or even better, have it automatically map the paths for output based on the directories in the assets directory. 甚至更好的是,它可以根据资产目录中的目录自动映射输出路径。

Found a solution to my question. 找到了我的问题的解决方案。

For the css part of it I can use SASS's @import in a master.scss file which just @imports all the scss files for various bits of my project. 对于它的css部分,我可以在master.scss文件中使用SASS的@import,该文件仅@import为项目的各个位导入所有的scss文件。

I guess for the JS I would do something similar with requirejs(?). 我猜对于JS,我会对requirejs(?)做类似的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM