如何以自定义方式将js文件与grunt.js组合

How to combine js file in a custom way with grunt.js?

本文关键字:js 文件 grunt 组合 自定义 方式      更新时间:2023-09-26

我想要一个基于令牌的grunt搜索和替换功能。

  single:{
                input:"./input.js",
                output:"./output.js",
                tokens:[{
                    token:"$1",
                    file:"./file.js"
                },{
                    token:"%2",
                    string:"replacement string"
                },{
                    token:"!3",
                    file:"./file.txt"
                }]
            },

来自咕哝组合https://github.com/mcgaryes/grunt-combine/

grunt.4版本不支持此功能。那里有任何类似的图书馆。。或者默认情况下使用out"concat"方法,我们可以执行此操作吗。。?

也许您正在寻找类似grunt replace的东西?

来自文档:

replace: {
  dist: {
    options: {
      variables: {
        'key': 'value'
      }
    }
  }
}