Last active
August 29, 2015 14:00
-
-
Save torounit/0231c52f974b2bcab240 to your computer and use it in GitHub Desktop.
最近のGruntfile
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
module.exports = (grunt) -> | |
# ================================== | |
# | |
# Load Tasks. | |
# | |
# ================================== | |
pkg = grunt.file.readJSON('package.json') | |
for taskName of pkg.devDependencies | |
grunt.loadNpmTasks taskName if taskName.substring(0, 6) is 'grunt-' | |
# ================================== | |
# | |
# Grunt Initalize. | |
# | |
# ================================== | |
grunt.initConfig | |
# ================================== | |
# | |
# Directory Setting. | |
# | |
# ================================== | |
dir: | |
assets: 'assets' | |
coffee: '<%= dir.assets %>/coffee' | |
javascripts: '<%= dir.assets %>/javascripts' | |
vendor: '<%= dir.assets %>/vendor' | |
stylesheets: '<%= dir.assets %>/stylesheets' | |
sass: '<%= dir.assets %>/sass' | |
# ================================== | |
# | |
# Watch file. | |
# | |
# ================================== | |
esteWatch: { | |
options: | |
dirs: [ './', '<%= dir.sass %>', '<%= dir.sass %>/**', '<%= dir.coffee %>/**' , '<%= dir.stylesheets %>', '<%= dir.javascripts %>' , '<%= dir.assets %>/typescripts' ] | |
extensions: ['scss','coffee','js','css','php', "ts"] | |
livereload: | |
extensions: ['js','css','php'] | |
enabled: true | |
scss: (filepath) -> | |
return ['compass:dev'] | |
coffee: (filepath) -> | |
return ["browserify"] | |
} | |
# ================================== | |
# | |
# Compass | |
# use config.rb. | |
# | |
# ================================== | |
compass: { | |
dev: { | |
options: { | |
bundleExec: true | |
config: 'config.rb' | |
environment: 'development' | |
} | |
} | |
dist: { | |
options: { | |
bundleExec: true | |
config: 'config.rb' | |
environment: 'production' | |
} | |
} | |
} | |
# ================================= | |
cssmin: { | |
minify: { | |
expand: true, | |
cwd: '<%= dir.stylesheets %>', | |
src: ['*.css', '!*.min.css'], | |
dest: '<%= dir.stylesheets %>', | |
ext: '.min.css' | |
} | |
} | |
# ================================= | |
browserify: { | |
dist: { | |
files: { | |
'<%= dir.javascripts %>/all.js': ['<%= dir.coffee %>/all.coffee'], | |
}, | |
options: { | |
transform: ['coffeeify' , "debowerify"] | |
} | |
} | |
} | |
# ================================== | |
# | |
# Style Guide | |
# | |
# ================================== | |
# KSS styleguide generator for grunt. | |
kss: | |
options: | |
includeType: 'css' | |
includePath: '<%= dir.stylesheets %>/all.css' | |
dist: | |
files: | |
'docs/styleguide': ['<%= dir.sass %>'] | |
# ================================== | |
# | |
# minify javascripts. | |
# | |
# ================================== | |
uglify: | |
compress: | |
files: | |
'<%= dir.javascripts %>/all.min.js': ['<%= dir.javascripts %>/all.js'] | |
# ================================== | |
# | |
# Register Task. | |
# | |
# grunt - watch and Compile. | |
# grunt bowerinit - build javascript installed by bower. | |
# | |
# ================================== | |
grunt.registerTask 'build', ['compass:dist','kss','cssmin','browserify', "uglify"] | |
grunt.registerTask 'default', ['esteWatch'] |
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
{ | |
"name": "mygrunt", | |
"version": "0.0.1", | |
"description": "GrandSportJapan grunt task", | |
"main": "Gruntfile.coffee", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Toro_Unit", | |
"license": "GPL v2 or later", | |
"devDependencies": { | |
"coffee-script": "*", | |
"coffeeify": "*", | |
"debowerify": "*", | |
"grunt": "*", | |
"grunt-browserify": "*", | |
"grunt-contrib-compass": "*", | |
"grunt-contrib-cssmin": "*", | |
"grunt-contrib-uglify": "^0.4.0", | |
"grunt-este-watch": "*", | |
"grunt-kss": "*" | |
} | |
} |
Author
torounit
commented
May 2, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment