Running a command in a Grunt Task

后端 未结 6 2001
借酒劲吻你
借酒劲吻你 2020-12-02 07:43

I\'m using Grunt (task-based command line build tool for JavaScript projects) in my project. I\'ve created a custom tag and I am wondering if it is possible to run a command

6条回答
  •  情书的邮戳
    2020-12-02 08:17

    Alternatively you could load in grunt plugins to help this:

    grunt-shell example:

    shell: {
      make_directory: {
        command: 'mkdir test'
      }
    }
    

    or grunt-exec example:

    exec: {
      remove_logs: {
        command: 'rm -f *.log'
      },
      list_files: {
        command: 'ls -l **',
        stdout: true
      },
      echo_grunt_version: {
        command: function(grunt) { return 'echo ' + grunt.version; },
        stdout: true
      }
    }
    

提交回复
热议问题