[컴][javascript] grunt 로 project 만들기




package.json 생성

npm init


install packages

npm install grunt-cli --save

npm install bower --save

...

bower.json 생성

bower init

bower install jquery --save

...


Grunt

npm install load-grunt-tasks --save


Gruntfile.js 예제

var paths = {
  
  src:   'src/',
  dest:  'build/',

  
};

module.exports = function(grunt) {

  /*  Load tasks  */

  require('load-grunt-tasks')(grunt);

  /*  Configure project  */

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    // Setup tasks
    coffee:   require('./tasks/coffee')(paths),
    concat:   require('./tasks/concat')(paths),
    uglify:   require('./tasks/uglify')(paths),
    copy:     require('./tasks/copy')(paths),
    
  
  });
  
  /*  Register tasks  */
  
  // Default task.
  grunt.registerTask('default', ['coffee:compile']);
  grunt.registerTask('_default', ['coffee:compile', 'concat:build', 'uglify:minify', 'less:build', 'cssmin:minify', 'copy:locale']);


};





Reference

  1. Is there a way to automatically build the package.json file for Node.js projects - Stack Overflow




댓글 없음:

댓글 쓰기