Created
January 1, 2015 11:45
-
-
Save namutaka/94073bebe59e7c5edc21 to your computer and use it in GitHub Desktop.
Grunt browserify sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @file Gruntfile.js | |
// https://github.com/yeoman/generator-angular/blob/master/templates/common/root/_Gruntfile.js | |
module.exports = function (grunt) { | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
// https://github.com/jmreidy/grunt-browserify/tree/master/examples/basic | |
browserify : { // タスク名. $ grunt browserify で実行できる | |
dist : { | |
src : 'src/main/webapp/WEB-INF/assets/js/main.js', // エントリーポイントとなるファイル | |
dest : 'src/main/webapp/assets/js/main.js' // 出力するファイル名 | |
}, | |
options: { | |
browserifyOptions: { | |
debug: true | |
}, | |
alias: [ | |
"./bower_components/angularjs/angular.min.js:angularjs" | |
] | |
} | |
}, | |
watch : { // タスク名. $ grunt watch で実行できる | |
options: { | |
livereload: true | |
}, | |
scripts : { | |
files : ['src/main/webapp/WEB-INF/assets/js/**/*.js'], // 監視対象のファイル | |
tasks : ['browserify'] // 変更があったら呼ばれるタスク | |
}, | |
connect: { | |
files: ['src/main/webapp/WEB-INF/**/*.html'] | |
} | |
}, | |
connect: { | |
server: { | |
options: { | |
livereload: 35729, | |
port: 9000, | |
base: 'src/main/webapp' | |
} | |
} | |
} | |
}); | |
// $ grunt で実行するタスクに watch を指定 | |
grunt.registerTask('default', ['browserify', 'connect', 'watch']); | |
}; | |
//http://yutapon.hatenablog.com/entry/2014/03/09/205231 | |
//http://efcl.info/2014/0120/res3605/ | |
//https://www.npmjs.com/package/grunt-browserify2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment