Created
August 11, 2015 05:22
-
-
Save oosugi20/5b1bead4bd93902c7e8d to your computer and use it in GitHub Desktop.
汎用 Gruntfile
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
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