Created
October 9, 2013 10:52
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 = function(grunt) { | |
'use strict'; | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-stylus'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-img'); | |
grunt.registerTask('default', ['stylus', 'copy', 'uglify', 'cssmin', 'img']); | |
grunt.registerTask('reload', ['copy', 'uglify', 'cssmin']); | |
grunt.registerTask('dev', ['watch']); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
copy: { | |
img: { | |
files: [{ | |
expand: true, | |
src: '**/*', | |
dest: './tmp/img', | |
cwd: './src/img' | |
}] | |
}, | |
js: { | |
files: [{ | |
expand: true, | |
src: '**/*', | |
dest: './tmp/js', | |
cwd: './src/js' | |
}] | |
}, | |
css: { | |
files: [{ | |
expand: true, | |
src: '**/*.css', | |
dest: './tmp/css', | |
cwd: './src/css' | |
}] | |
} | |
}, | |
uglify: { | |
dist: { | |
options: { | |
mangle: true, | |
preserveComments: 'some' | |
}, | |
files: [ | |
{ | |
'./app/js/hoge.js': [ | |
'./tmp/js/lib/jquery-2.0.3.js', | |
'./tmp/js/lib/jquery.flexslider.js', | |
'./tmp/js/lib/klass.min.js', | |
'./tmp/js/lib/code.photoswipe-3.0.5.js', | |
'./tmp/js/main.js' | |
] | |
} | |
] | |
} | |
}, | |
cssmin: { | |
minify: { | |
expand: true, | |
cwd: './tmp/css', | |
src: '**/*.css', | |
dest: './tmp/css', | |
ext: '.min.css' | |
}, | |
conbine: { | |
files: { | |
'./app/css/hoge.css': [ | |
'./tmp/css/flexslider.min.css', | |
'./tmp/css/photoswipe.min.css', | |
'./tmp/css/main.min.css' | |
] | |
} | |
} | |
}, | |
img: { | |
dist: { | |
src: ['./tmp/**/*'], | |
dest: './app/img' | |
} | |
}, | |
stylus: { | |
compile: { | |
src: './src/css/main.styl', | |
dest: './src/css/main.css', | |
options: { | |
compress: false | |
} | |
} | |
}, | |
watch: { | |
stylus: { | |
files: [ | |
'./src/css/**/*.styl' | |
], | |
tasks: ['stylus'] | |
}, | |
reload: { | |
files: [ | |
'./src/**/*.html', | |
'./src/css/**/*.css', | |
'./src/js/**/*.js' | |
], | |
tasks: ['reload'] | |
}, | |
reloadImg: { | |
files: [ | |
'./src/img/**/*' | |
], | |
tasks: ['copy:img', 'img'] | |
} | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment