根据早午餐文档,配置文件中的属性"conventions.assets“应该是regexp,但我试图包括以下内容:
conventions: {
assets: /^app\/.*\.html/
}以便将所有html添加到公用文件夹中。(我知道我可以创建一个资产文件夹并包含所有的东西,但根据我们商定的结构,到目前为止还不可能)。
我认为这个属性需要一个目录,在这种情况下,我能修复这个值以达到我的目标吗?
发布于 2013-09-04 08:35:03
最后,我可以重写属性“资产”所接受的方法。
assets: function(path) {
/**
* Loops every path and returns path|true|false according what we need
* @param path file or directory's path
* @returns path if it is a directory
* true if it fit with the regular expression
* false otherwise
*
*/
if( /\/$/.test(path) ) return path;
return /^app\/.*\.html/.test(path); // RegExp for anything we need
}发布于 2016-08-25 09:30:08
我只是想评论一下我的函数是什么样子的,如果有人很难弄明白如何继续:
assets: function(path) {
/**
* Loops every path and returns path|true|false according what we need
* @param path file or directory's path
* @returns path if it is a directory
* true if it fit with the regular expression
* false otherwise
*
*/
if( /\/$/.test(path) ) return path;
return /^(app|assets)\/.*\.(html|png|jpg|jpeg|eot|svg|ttf|woff)/.test(path);
}这将将扩展名为:app和assets-folder的文件移动到public-folder中。
我决定将assets-folder移到根结构,所以我们的结构现在如下所示:
frontend
- app
-- common/
-- styles/
-- etc etc
- assets
-- index.html
-- css/
-- images/
-- etc etchttps://stackoverflow.com/questions/18595609
复制相似问题