【问题标题】:How to run Grunt Copy Task automatically when our project run当我们的项目运行时如何自动运行 Grunt Copy Task
【发布时间】:2022-02-08 04:48:24
【问题描述】:

我想在我的项目启动时自动将一些文件从一个文件夹复制到另一个文件夹。现在我通过在 cmd“grunt copy”中运行命令来完成。请帮我解决这个问题。

我的 Gruntfile.js 代码:

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        copy: {
            t1: {
                src: 'Scripts/**',
                dest:'Target/'
            }
        } 
    });

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.registerTask('default', 'copy:t1');
};

【问题讨论】:

  • “我的项目何时开始”是什么意思?
  • 我的意思是,当我按 Ctrl+F5 运行我的项目时,然后 grunt 任务应该会自动完成,这样我就不需要一次又一次地从 cmd 运行命令。

标签: node.js gruntjs grunt-contrib-copy


【解决方案1】:

我认为你需要 grunt.registerTask('default', ['copy:t1']);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-04
    • 2013-02-16
    • 2019-12-31
    • 2014-10-04
    • 1970-01-01
    • 2014-10-07
    • 2018-04-18
    • 2015-10-09
    相关资源
    最近更新 更多