简体   繁体   English

如何在包装功能中咕con concat

[英]How to grunt concat in a wrapping function

I have three files containing js classes: 我有三个包含js类的文件:

A.js
B.js
C.js

I'm trying to concatenate them to get something like: 我正在尝试将它们连接起来以获得类似以下内容:

var Module = (function (scope) {
// content of concatenation (ABC.js)
})(scope);

For now I'm using https://www.npmjs.com/package/grunt-contrib-concat to concatenate, I saw https://www.npmjs.com/package/grunt-wrap , it seems to be abandonned but look like what I want. 现在我正在使用https://www.npmjs.com/package/grunt-contrib-concat进行连接,我看到了https://www.npmjs.com/package/grunt-wrap ,它似乎被放弃了,但是看起来像我想要的

Someone has an idea to achieve it without using grunt-concat? 有人有一个想法,而无需使用grunt-concat吗?

PS: I want to keep a *.map file for debug purpose PS:我想保留一个* .map文件用于调试

Are you looking for the banner/footer of https://github.com/gruntjs/grunt-contrib-concat ? 您是否在寻找https://github.com/gruntjs/grunt-contrib-concat的横幅/页脚?

Or this kind of concatenation with 2 files for intro and outro? 还是这种带有2个文件的介绍和结尾的串联? I'm trying out Grunt and need a simple way to concatenate my modules 我正在尝试Grunt,需要一种简单的方法来连接我的模块

I think you might want to have a look at Browserify and Browserify-shim . 我认为您可能想看看BrowserifyBrowserify-shim It's an excellent way of scoping your dependencies without polluting the global namespace. 这是一种在不污染全局命名空间的情况下确定依赖关系的绝佳方法。 It's works well with grunt and gulp and supports sourcemaps too. 它适用于grunt和gulp,也支持源地图。

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

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