在这种情况下如何指定分隔符:
我用grunt-concat这样连接我的文件:
我用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,是你的朋友:
concat: { options: { process: function(src,filepath) { return '//####' + filepath + '\n' + src; } } },...