Last active
December 14, 2015 23:38
-
-
Save yokotak0527/5166676 to your computer and use it in GitHub Desktop.
orig_concat動かす為にexecを使うのはなんか違う気がする。後で調べる
This file contains 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
'use strict'; | |
module.exports = function(grunt){ | |
var config = grunt.config, | |
exec = require('child_process').exec, | |
say = 'say -v kyoko '; | |
var jsDir = 'sample/build/'; // jsのディレクトリ | |
var jsDestDir = 'sample/'; | |
// ========================================================================= | |
// モジュールの読み込み | |
// ========================================================================= | |
grunt.loadNpmTasks('grunt-contrib'); | |
// ========================================================================= | |
// initConfig | |
// ========================================================================= | |
grunt.initConfig({ | |
// --------------------------------------------------------------------- | |
// パッケージの指定 | |
// --------------------------------------------------------------------- | |
pkg:grunt.file.readJSON('package.json'), | |
// --------------------------------------------------------------------- | |
// concatの設定 | |
// --------------------------------------------------------------------- | |
concat:{ | |
dist:{ | |
src:[ | |
jsDir+'header.js', | |
jsDir+'main.js', | |
jsDir+'footer.js' | |
], | |
dest:jsDestDir+'sample.js' | |
} | |
}, | |
// --------------------------------------------------------------------- | |
// watchの設定 | |
// --------------------------------------------------------------------- | |
watch:{ | |
// scriptsのビルド | |
scripts:{ | |
files:['<%= concat.dist.src %>'], | |
tasks:['concat'] | |
} | |
} | |
// --------------------------------------------------------------------- | |
}); | |
// ========================================================================= | |
// concat | |
// ========================================================================= | |
var concat = config.get('concat'); | |
if(concat){ | |
config.set('orig_concat',concat); | |
grunt.renameTask('concat','orig_concat'); | |
grunt.registerTask('concat',function(){ | |
exec('grunt orig_concat'); | |
exec(say+'結合しました。'); | |
grunt.event.emit('concat.done'); | |
}); | |
} | |
// ========================================================================= | |
// 外部タスク | |
// ========================================================================= | |
//grunt.task.loadTasks('tasks'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment