grunt-depend-concat 不会用文件内容替换@depend 标签

grunt-depend-concat is not replace @depend tags with file contents

我正在尝试使用 grunt-depend-concat 创建一个 site.uncompressed.js 文件,其中包含在我的 site.js 文件中使用 @depend 标记的所有依赖项的内容。正在创建目标文件,但@depend 注释仍在文件顶部。我是否正确使用了这个 grunt 包?我的代码有问题吗?如果我仍然可以使用 @depend 标签,我愿意接受其他 Grunt 包,但是 grunt 包文档相当稀疏,我可以弄清楚还有什么可能做到这一点。

site.js(部分):

/**
 * @depend vendor/jquery-1.11.1.min.js
 * @depend vendor/jquery.smooth-scroll-1.4.13.min.js
 […]
 */

[…]

Gruntfile.js:

(function () {
    'use strict';
}());

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        filepaths: {
            assetDir: 'httpdocs/files/assets/',
            jsDir: '<%= filepaths.assetDir %>' + 'js/',
            jsSrc: '<%= filepaths.jsDir %>' + 'site.js',
            jsComb: '<%= filepaths.jsDir %>' + 'site.uncompressed.js',
            jsMin: '<%= filepaths.jsDir %>' + 'site.min.js';
        },

    'depend-concat': {
        depend_doctag: {
            options: {
                method: {
                    type: 'doctag',
                    tag: 'depend'
                }
            },
            src: ['<%= filepaths.jsSrc %>'],
            dest: '<%= filepaths.jsComb %>'
        },
    },
    uglify: {
        options: {
            preserveComments: false,
            banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */',
            sourceMap: true
        },
        dist: {
            files: {
                '<%= filepaths.jsMin %>': ['<%= filepaths.jsComb %>']
            }
        }
    }
});

require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['jshint', 'depend-concat', 'uglify']);
};

Grunt 输出:

Running "jshint:files" (jshint) task

>> 2 files lint free.

Running "depend-concat:depend_doctag" (depend-concat) task File "httpdocs/files/assets/js/site.uncompressed.js" created.

Running "uglify:dist" (uglify) task

>> 1 sourcemap created.

>> 1 file created.

Done, without errors.

site.uncompressed.js(部分):

/**
 * @depend vendor/jquery-1.11.1.min.js
 * @depend vendor/jquery.smooth-scroll-1.4.13.min.js
 […]
*/

不幸的是,我无法让这个 Grunt 插件正常工作,所以我放弃了在 site.js 文件中使用带有 @depend 规则的 grunt-depend-concat。

我在 Gruntfile 中添加了一个文件路径部分,然后改用 grunt-contrib-concat 插件。