Created
September 20, 2015 10:24
-
-
Save MightyPork/04dba5ed94a1fe1e743b to your computer and use it in GitHub Desktop.
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) { | |
grunt.file.defaultEncoding = 'utf8'; | |
grunt.file.preserveBOM = false; | |
grunt.initConfig({ | |
copy: { | |
fonts: { | |
files: [ | |
// bootstrap fonts | |
{ | |
cwd: 'vendor/bower/bootstrap-sass-official/assets/fonts/bootstrap', | |
src: ['**'], | |
dest: 'www/fonts/', | |
expand: true | |
}, | |
// font awesome | |
{ | |
cwd: 'vendor/bower/font-awesome/fonts', | |
src: ['**'], | |
dest: 'www/fonts/', | |
expand: true | |
}, | |
// my fonts | |
{ | |
cwd: 'app/assets/fonts', | |
src: ['**'], | |
dest: 'www/fonts/', | |
expand: true | |
} | |
] | |
}, | |
images: { | |
files: [ | |
// my images | |
{ | |
cwd: 'app/assets/images', | |
src: ['**'], | |
dest: 'www/images/', | |
expand: true | |
} | |
] | |
} | |
}, | |
concat: { | |
js: { | |
src: [ | |
'vendor/bower/jquery/dist/jquery.js', | |
'vendor/bower/bootstrap-sass-official/assets/javascripts/*.js', | |
'app/assets/javascripts/*.js' | |
], | |
dest: 'www/js/application.js' | |
} | |
}, | |
uglify: { | |
options: { | |
mangle: true // JS obfuscation | |
}, | |
js: { | |
files: { | |
'www/js/application.min.js': 'www/js/application.js' | |
} | |
} | |
}, | |
sass: { | |
development: { | |
options: { | |
style: 'expanded', // pretty format | |
loadPath: '.', // suppress warning about -I flag by default being deprecated | |
}, | |
files: { | |
"www/css/application.css": "app/assets/stylesheets/application.scss" | |
} | |
} | |
}, | |
cssmin: { | |
minify: { | |
expand: true, | |
cwd: 'www/css', | |
src: ['*.css', '!*.min.css'], | |
dest: 'www/css', | |
ext: '.min.css' | |
} | |
}, | |
watch: { | |
js: { | |
files: [ | |
'vendor/bower/jquery/dist/jquery.js', | |
'vendor/bower/bootstrap-sass-official/assets/javascripts/bootstrap.js', | |
'app/assets/javascripts/*.js' | |
], | |
tasks: ['concat:js', 'uglify:js'] | |
}, | |
sass: { | |
options: { | |
livereload: true | |
}, | |
files: ['app/assets/stylesheets/*.scss'], | |
tasks: ['sass','cssmin'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.registerTask('default', ['watch']); | |
grunt.registerTask('build', ['copy', 'concat', 'uglify', 'sass', 'cssmin']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment