【问题标题】:grunt concat not concatenatinggrunt concat 未连接
【发布时间】:2014-10-10 21:44:30
【问题描述】:

我正在尝试使用 Grunt 来合并和缩小 mi 站点的静态文件,但我发现“concat”存在一些奇怪的问题。我已经按照自己的意愿通过 grunt 工作了指南针,但由于某种原因 concat 根本没有产生任何输出......

我的 Gruntfile.js 内容如下:

    concat: {
        options: {
            separator: ';',
            nonull: true
        },
        dist: {
            options: {
                src: ['testsrc/*.js'],
                dest: 'app.min.js'
            }
        }
    },

我在 testsrc 中有几个 js 文件,我想从中生成 app.min.js。但是当我运行 grunt concat 我得到这个输出:

Running tasks: concat:dist

Running "concat:dist" (concat) task
Verifying property concat.dist exists in config...OK
File: [no files]
Options: separator=";", banner="", footer="", stripBanners=false, process=false, sourceMap=false, sourceMapName=undefined, sourceMapStyle="embed", nonull, src=["testsrc/*.js"], dest="app.min.js"

Done, without errors.

... app.min.js 无处可寻。

不应该按原样工作吗?当然 grunt-contrib-concat 是在我的 package.json 中声明的(否则上面根本不起作用)......我看到“文件:[无文件]”结果,但我认为通过声明 src Grunt会找到所需的文件。

【问题讨论】:

    标签: gruntjs grunt-contrib-concat


    【解决方案1】:

    是因为testsrc vs test的错字吗?

    顺便说一句,对于 dist 目标,除非您需要重用,否则无需使用选项包装 src/dest。

    【讨论】:

    • 不,抱歉。这是我的问题中的错字,而不是实际代码中的错字。
    • 不是错字,而是通过删除封闭的“选项”块,它起作用了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-13
    • 1970-01-01
    • 2015-08-04
    • 1970-01-01
    • 1970-01-01
    • 2013-04-14
    • 1970-01-01
    相关资源
    最近更新 更多