Created
December 3, 2013 08:39
-
-
Save geta6/7765931 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
### | |
Gruntfile by geta6 | |
usage: | |
grunt only build | |
grunt server + watch | |
install: | |
npm i --save-dev \ | |
grunt \ | |
grunt-contrib-copy \ | |
grunt-contrib-coffee \ | |
grunt-contrib-stylus \ | |
grunt-contrib-jade \ | |
grunt-contrib-csslint \ | |
grunt-contrib-uglify \ | |
grunt-contrib-cssmin \ | |
grunt-contrib-imagemin \ | |
grunt-contrib-watch \ | |
grunt-coffeelint | |
### | |
module.exports = (grunt) -> | |
'use strict' | |
grunt.loadNpmTasks 'grunt-contrib-copy' | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-stylus' | |
grunt.loadNpmTasks 'grunt-contrib-jade' | |
grunt.loadNpmTasks 'grunt-contrib-csslint' | |
grunt.loadNpmTasks 'grunt-contrib-uglify' | |
grunt.loadNpmTasks 'grunt-contrib-cssmin' | |
grunt.loadNpmTasks 'grunt-contrib-imagemin' | |
grunt.loadNpmTasks 'grunt-contrib-watch' | |
grunt.loadNpmTasks 'grunt-coffeelint' | |
grunt.registerTask 'server', ['default', 'watch'] | |
grunt.registerTask 'default', ['copy', 'coffeelint', 'coffee', 'uglify', 'stylus', 'csslint', 'cssmin', 'jade', 'imagemin'] | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
copy: | |
img: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.{jpg,png,gif}' ] | |
dest: 'dist/' | |
}] | |
js: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.js' ] | |
dest: 'dist/' | |
}] | |
css: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.css' ] | |
dest: 'dist/' | |
}] | |
source: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.coffee' ] | |
dest: 'dist/' | |
}] | |
coffee: | |
options: | |
sourceMap: yes | |
sourceRoot: '' | |
dist: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.coffee' ] | |
dest: 'dist/' | |
ext: '.js' | |
}] | |
stylus: | |
options: | |
compress: no | |
dist: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.styl' ] | |
dest: 'dist/' | |
ext: '.css' | |
}] | |
jade: | |
debug: | |
options: | |
pretty: yes | |
data: version: '<%- pkg.version %>' | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.jade' ] | |
dest: 'dist/' | |
ext: '.html' | |
}] | |
dist: | |
options: | |
data: version: '<%- pkg.version %>' | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.jade' ] | |
dest: 'public/' | |
ext: '.html' | |
}] | |
coffeelint: | |
all: | |
files: [{ | |
expand: yes | |
cwd: 'assets/' | |
src: [ '**/*.coffee' ] | |
}] | |
csslint: | |
options: | |
csslintrc: '.csslintrc' | |
strict: | |
options: | |
import: 2 | |
src: 'dist/**/*.css' | |
uglify: | |
dist: | |
options: | |
mangle: on | |
files: [{ | |
expand: yes | |
cwd: 'dist/' | |
src: [ '**/*.js' ] | |
dest: 'public/' | |
ext: '.js' | |
}] | |
cssmin: | |
dist: | |
files: [{ | |
expand: yes | |
cwd: 'dist/' | |
src: [ '**/*.css' ] | |
dest: 'public/' | |
ext: '.css' | |
}] | |
imagemin: | |
dist: | |
files: [{ | |
expand: yes | |
cwd: 'dist/' | |
src: [ '**/*.{jpg,png,gif}' ] | |
dest: 'public/' | |
}] | |
watch: | |
options: | |
livereload: yes | |
dateFormat: (time) -> | |
grunt.log.writeln "The watch finished in #{time}ms at #{new Date().toLocaleTimeString()}" | |
coffee: | |
files: ['assets/**/*.coffee'] | |
tasks: ['coffeelint', 'coffee', 'uglify'] | |
jade: | |
files: ['assets/*.jade'] | |
tasks: ['jade'] | |
stylus: | |
files: ['assets/**/*.styl'] | |
tasks: ['stylus', 'csslint', 'cssmin'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment