gpt4 book ai didi

javascript - grunt-concat 分隔符选项?

转载 作者:IT老高 更新时间:2023-10-28 11:20:58 24 4
gpt4 key购买 nike

在这种情况下如何指定分隔符:
我以这种方式将我的文件与 grunt-concat 连接起来:

concat: {
options: {
banner: '<%= banner %>',
separator: ""
},
dist: {
files:{
'<%= distdir %>/public/scripts/ieditor.js': [
'public/scripts/ieditor/vars.js',
'public/scripts/ieditor/controllers/*.js',
'public/scripts/ieditor/directives/*.js',
'public/scripts/ieditor/app.js',
'public/scripts/ieditor/services/*.js',
'public/scripts/ieditor/filters/*.js'
],
'<%= distdir %>/public/scripts/dashboard.js': [
'public/scripts/dashboard/vars.js',
'public/scripts/dashboard/controllers/*.js',
'public/scripts/dashboard/directives/*.js',
'public/scripts/dashboard/app.js',
'public/scripts/dashboard/services/*.js',
'public/scripts/dashboard/filters/*.js'
]
}
}
}

我想要的是在连接 CSS 文件时将最终结果映射到原始文件,如指南针。
示例:

//####public/scripts/ieditor/vars.js###############
content of public/scripts/ieditor/vars.js
//####public/scripts/ieditor/controllers/a.js######
content of public/scripts/ieditor/controllers/a.js
//####public/scripts/ieditor/controllers/b.js######
content of public/scripts/ieditor/controllers/b.js
.....

那么,要连接的当前文件的名称是什么,所以我可以在选项区域中执行类似的操作:

  options: {
banner: '<%= banner %>',
separator: "<%= current_file_name %>"
},

提前致谢。

最佳答案

process option, specified as a function , 是你的 friend 吗:

concat: {
options: {
process: function(src, filepath) {
return '//####' + filepath + '\n' + src;
}
}
},
...

关于javascript - grunt-concat 分隔符选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15750017/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com