简体   繁体   English

如何在我们的项目运行时自动运行Grunt Copy Task

[英]How to run Grunt Copy Task automatically when our project run

I want to copy some files from one folder to another automatically when my project start.Now I do it by run a command in cmd "grunt copy".我想在我的项目启动时自动将一些文件从一个文件夹复制到另一个文件夹。现在我通过在 cmd“grunt copy”中运行命令来完成它。 Please help me on this.请帮我解决这个问题。

My Gruntfile.js Code:我的 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');
};

I think you need to have grunt.registerTask('default', ['copy:t1']);我认为你需要 grunt.registerTask('default', ['copy:t1']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM