Skip to content

Instantly share code, notes, and snippets.

@yokotak0527
Last active December 14, 2015 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokotak0527/5166676 to your computer and use it in GitHub Desktop.
Save yokotak0527/5166676 to your computer and use it in GitHub Desktop.
orig_concat動かす為にexecを使うのはなんか違う気がする。後で調べる
'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