咕噜

编程入门 行业动态 更新时间:2024-10-27 00:31:04
本文介绍了咕噜-CONCAT分离器的选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何指定在这种情况下分隔符:结果我在我的串联文件,咕噜-CONCAT是这样的:

how to specify a separator in this scenario: I'm concatenating my files with grunt-concat this way:

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文件时,最终结果。结果例如:

what I want is to get a final result mapped to the original files like in compass when concatenating CSS files. Example:

//####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 .....

所以,有什么名字指的是当前文件被连接在一起,所以我可以做的选项区域中是这样的:

So what's the name referring to the current file being concatenated so i can do something like this in the options area:

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

先谢谢了。

推荐答案

过程选项,指定为功能,是你的朋友:

The process option, specified as a function, is your friend:

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

更多推荐

咕噜

本文发布于:2023-11-25 07:28:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628858.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!