grunt htmlmin没有发送到dist文件夹

时间:2015-07-04 18:35:14

标签: gruntjs

我设置了我的咕噜声来缩小我的html,但是当我运行'grunt htmlmin'时 它没有发送到我的dist文件夹,这是我使用的设置:

htmlmin: {
    dist: {
        options: {
            removeComments: true,
            collapseWhitespace: true
        },
        files: [{
            expand: true,
            cwd: 'src',
            src: '**/*.html',
            dest: 'dist/'
        }],
        },
    },

我有什么设置错了吗?

1 个答案:

答案 0 :(得分:0)

您的配置似乎很好 - 下面是我的机器上可以使用的确切Gruntfile.js。你可以尝试一下吗?

module.exports = function(grunt) {
    grunt.initConfig({
        htmlmin: {
            dist: {
                options: {
                    removeComments: true,
                    collapseWhitespace: true
                },
                files: [{
                    expand: true,
                    cwd: 'src',
                    src: '**/*.html',
                    dest: 'dist/'
                }],
            },
        },
    });
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.registerTask('default', ['htmlmin']);
};
相关问题