Skip to content

Instantly share code, notes, and snippets.

@oosugi20
Created August 11, 2015 05:22
Show Gist options
  • Save oosugi20/5b1bead4bd93902c7e8d to your computer and use it in GitHub Desktop.
Save oosugi20/5b1bead4bd93902c7e8d to your computer and use it in GitHub Desktop.
汎用 Gruntfile
module.exports = (grunt) ->
# package.jsonをロード
config =
pkg: grunt.file.readJSON('package.json')
# Gruntプラグインをロード
Object.keys(config.pkg.devDependencies).forEach (key) ->
if /^grunt-/.test(key)
grunt.loadNpmTasks key
# 各種設定をロードして config に入れる
grunt.file.expand('./grunt/config/*.coffee').forEach (file_path) ->
key = file_path.replace(/\.\/grunt\/config\/(.*)\.coffee/, '$1')
config[key] = require(file_path)
# ロードした内容で初期化
grunt.initConfig config
# タスク設定をロード
grunt.file.expand('./grunt/task/*.coffee').forEach (file_path) ->
require(file_path)(grunt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment