Created
December 10, 2013 07:28
-
-
Save cotapon/7886950 to your computer and use it in GitHub Desktop.
jadeとstylusとcoffeeのgruntを作ってみた ref: http://qiita.com/cotapon@github/items/2fd644381fa6860875d8
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
Gruntfile.coffee | |
package.json | |
src/ | |
jade/sample.jade | |
stylus/sample.styl | |
coffee/sample.coffee | |
images/sample.jpg |
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
npm install |
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
grunt |
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
Gruntfile.coffee | |
package.json | |
dist/ | |
sample.html | |
js/ | |
sample.js | |
css/ | |
sample.css | |
img/ | |
sample.jpg | |
src/ | |
jade/sample.jade | |
stylus/sample.styl | |
coffee/sample.coffee | |
images/sample.jpg |
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
grunt w |
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
grunt build |
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
selector { | |
transition: transform 1s; | |
} |
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
selector { | |
-webkit-transition: -webkit-transform 1s; | |
transition: transform 1s; | |
} |
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) -> | |
# load all grunt tasks | |
(require 'matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks) | |
_ = grunt.util._ | |
path = require 'path' | |
grunt.initConfig | |
pkg: grunt.file.readJSON('package.json') | |
# Metadata. | |
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today(\'yyyy-mm-dd\') %>\n' + '<%= pkg.homepage ? \'* \' + pkg.homepage + \'\\n\' : \'\' %>' + '* Copyright (c) <%= grunt.template.today(\'yyyy\') %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, \'type\').join(\', \') %> */\n' | |
dir: | |
src: 'src' | |
jade: 'jade' | |
styl: 'stylus' | |
coffee: 'coffee' | |
images: 'images' | |
js: 'js' | |
css: 'css' | |
img: 'images' | |
vendors: 'vendors' | |
dist: 'dist' | |
build: 'build' | |
docs: 'docs' | |
test: 'test' | |
jade: | |
dist: | |
options: | |
pretty: true, #htmlをインデント表記させる | |
expand: true | |
cwd: '<%= dir.src %>/<%= dir.jade %>' | |
src: '**/*.jade' | |
dest: '<%= dir.dist %>/' | |
ext: '.html' | |
stylus: | |
dist: | |
options: | |
compress: false | |
expand: true | |
cwd: '<%= dir.src %>/<%= dir.styl %>/' | |
src: '**/*.styl' | |
dest: '<%= dir.dist %>/<%= dir.css %>/' | |
ext: '.css' | |
coffee: | |
dist: | |
expand: true | |
cwd: '<%= dir.src %>/<%= dir.coffee %>' | |
src: '**/*.coffee' | |
dest: '<%= dir.dist %>/<%= dir.js %>' | |
ext: '.js' | |
htmlmin: | |
build: | |
options: | |
removeComments: true | |
collapseWhitespace: true | |
expand: true | |
cwd: '<%= dir.dist %>' | |
src: '**/*.html' | |
dest: '<%= dir.build %>' | |
ext: '.html' | |
cssmin: | |
build: | |
expand: true | |
cwd: '<%= dir.dist %>/<%= dir.css %>' | |
src: '**/*.css' | |
dest: '<%= dir.build %>/<%= dir.css %>' | |
ext: '.css' | |
uglify: | |
options: | |
banner: '<%= banner %>' | |
sourceMap: (path) -> | |
path + '.map' | |
build: | |
expand : true | |
src: '<%= dir.build %>/**/*.js' | |
# 画像の圧縮 | |
imagemin: | |
options: | |
optimizationLevel: 7 | |
pngquant: false | |
dist: | |
expand: true | |
cwd: '<%= dir.dist %>/<%= dir.images %>' | |
src: '**/*.{jpg,jpeg,gif}' | |
dest: '<%= dir.dist %>/<%= dir.img %>' | |
# coffeeの文法チェック | |
coffeelint: | |
app: '**/<%= dir.coffee %>/*.coffee' | |
# CSSのprefiexを補完 | |
autoprefixer: | |
options: | |
browsers: ['last 2 version', 'ie 8', 'ie 7', 'ie 6'] | |
dist: | |
expand: true | |
cwd: '<%= dir.dist %>/<%= dir.css %>' | |
src: '**/*.css' | |
dest: '<%= dir.dist %>/<%= dir.css %>/' | |
ext: '.css' | |
simplemocha: | |
dist: | |
src: '<%= dir.test %>/<%= dir.coffee %>/*.coffee' | |
options: | |
globals: ['should'] | |
timeout: 3000 | |
ignoreLeaks: false | |
grep: '*-test' | |
ui: 'bdd' | |
reporter: 'tap' | |
watch: | |
jade: | |
files: '<%= dir.src %>/**/*.jade', | |
tasks: 'jade:dist' | |
stylus: | |
files: '<%= dir.src %>/**/*.styl' | |
tasks: ['stylus:dist', 'autoprefixer:dist', 'styleguide:dist'] | |
coffee: | |
files: '<%= dir.src %>/**/*.coffee' | |
tasks: 'coffee:dist' | |
images: | |
files: ['<%= dir.src %>/**/*.{gif,jpeg,jpg,png,svg,webp}'] | |
tasks: ['clean:images', 'copy', 'imagemin'] | |
vendors: | |
files: ['<%= dir.src %>/<%= dir.vendors %>/'] | |
tasks: ['copy:vendors'] | |
livereload: | |
options: | |
livereload: '<%= connect.options.livereload %>' | |
files: [ | |
'<%= dir.dist %>/*.html', | |
'<%= dir.dist %>/**/*.css', | |
'<%= dir.dist %>/**/*.js', | |
'<%= dir.dist %>/**/*.{gif,jpeg,jpg,png,svg,webp}' | |
] | |
connect: | |
options: | |
port: 9000 | |
livereload: 35729 | |
hostname: 'localhost' | |
livereload: | |
options: | |
open: true | |
base: ['<%= dir.dist %>'] | |
copy: | |
img: | |
expand: true | |
dot: true | |
cwd: '<%= dir.src %>/<%= dir.images %>' | |
dest: '<%= dir.dist %>/<%= dir.img %>' | |
src: [ | |
'**/*.{gif,jpeg,jpg,png,svg,webp}', | |
] | |
vendors: | |
expand: true | |
dot: true | |
cwd: '<%= dir.src %>/<%= dir.vendors %>' | |
dest: '<%= dir.dist %>/<%= dir.vendors %>' | |
src: ['**'] | |
build: | |
expand: true | |
dot: false | |
cwd: '<%= dir.dist %>/' | |
dest: '<%= dir.build %>/' | |
src: ['**'] | |
yuidoc: | |
dist: | |
name: '<%= pkg.name %>' | |
description: '<%= pkg.description %>' | |
version: '<%= pkg.version %>' | |
options: | |
paths: '<%= dir.src %>/<%= dir.coffee %>/' | |
outdir: '<%= dir.docs %>/<%= dir.js %>' | |
syntaxtype: 'coffee' | |
extension: '.coffee' | |
styleguide: | |
dist: | |
files: | |
#'<%= dir.docs %>/<%= dir.css %>': '<%= dir.src %>/<%= dir.styl %>/**/*.styl' | |
'<%= dir.docs %>/<%= dir.css %>': '<%= dir.dist %>/<%= dir.css %>/**/*.css' | |
#'<%= dir.docs %>/<%= dir.css %>': '<%= dir.src %>/<%= dir.styl %>/**/*.sass' | |
clean: | |
dist: | |
src: [ | |
'<%= dir.dist %>/**/*.html', | |
'<%= dir.dist %>/<%= dir.js %>/**/*.js', | |
'<%= dir.dist %>/<%= dir.css %>/**/*.css', | |
'<%= dir.build %>', | |
'<%= dir.docs %>' | |
] | |
docs: | |
src: '<%= dir.docs %>' | |
images: | |
src: ['<%= dir.dist %>/<%= dir.img %>'] | |
grunt.registerTask 'default', [ | |
'clean', | |
'coffeelint', | |
'simplemocha', | |
'yuidoc' | |
'jade:dist', | |
'stylus:dist', | |
'autoprefixer', | |
'styleguide', | |
'coffee:dist', | |
'copy:img', | |
'copy:vendors', | |
'imagemin' | |
] | |
grunt.registerTask 'w', [ | |
'default', | |
'connect', | |
'watch', | |
'jshint', | |
] | |
grunt.registerTask 'compile', [ | |
'clean', | |
'coffee:dist', | |
'jade:dist', | |
'stylus:dist' | |
] | |
grunt.registerTask 'build', [ | |
'default', | |
'copy:build' | |
'htmlmin:build', | |
'cssmin:build', | |
'uglify' | |
] | |
grunt.registerTask 'c', ['compile'] | |
grunt.registerTask 'docs', ['clean:docs', 'yuidoc', 'styleguide'] |
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
{ | |
"name": "grunt-jade-stylus-coffee", | |
"version": "0.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": "", | |
"author": "", | |
"license": "BSD", | |
"devDependencies": { | |
"grunt-contrib-concat": "~0.3.0", | |
"grunt-contrib-copy": "~0.4.1", | |
"grunt-contrib-compass": "~0.6.0", | |
"grunt-contrib-clean": "~0.5.0", | |
"grunt-contrib-sass": "~0.5.1", | |
"grunt-contrib-htmlmin": "~0.1.3", | |
"grunt-contrib-csslint": "~0.1.2", | |
"grunt-contrib-cssmin": "~0.6.2", | |
"grunt-contrib-jst": "~0.5.1", | |
"grunt-contrib-coffee": "~0.7.0", | |
"grunt-contrib-qunit": "~0.3.0", | |
"grunt-contrib-connect": "~0.5.0", | |
"grunt-contrib-requirejs": "~0.4.1", | |
"grunt-contrib-jshint": "~0.6.5", | |
"grunt-contrib-jasmine": "~0.5.2", | |
"grunt-contrib-uglify": "~0.2.7", | |
"grunt-contrib-handlebars": "~0.5.12", | |
"grunt": "~0.4.2", | |
"grunt-contrib-compress": "~0.5.3", | |
"grunt-contrib-watch": "~0.5.3", | |
"grunt-contrib-stylus": "~0.8.0", | |
"grunt-contrib-jade": "~0.8.0", | |
"grunt-contrib-imagemin": "~0.3.0", | |
"grunt-contrib-less": "~0.7.0", | |
"grunt-contrib-nodeunit": "~0.2.2", | |
"grunt-contrib-yuidoc": "~0.5.0", | |
"grunt-contrib": "~0.8.0", | |
"matchdep": "~0.3.0", | |
"grunt-coffeelint": "0.0.7", | |
"grunt-simple-mocha": "~0.4.0", | |
"grunt-autoprefixer": "~0.4.1", | |
"grunt-styleguide": "~0.2.12" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment