Last active
August 29, 2015 14:03
-
-
Save jeff1evesque/b98560d6c4d9914049f9 to your computer and use it in GitHub Desktop.
Audio Anaylzer: Sample gruntfile.js for Sass Automation
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.js | |
* | |
* This file automates Sass, Uglify, and Imagemin | |
*/ | |
module.exports = function (grunt) { | |
grunt.initConfig({ | |
// Watch task configuration | |
watch: { | |
css: { | |
files: '../src/scss/*.scss', | |
tasks: ['sass'], | |
}, | |
js: { | |
files: '../src/js/*.js', | |
tasks: ['uglify'], | |
}, | |
img: { | |
files: '../src/img/*.{png,jpg,gif}', | |
tasks: ['imagemin'], | |
}, | |
}, | |
// Sass task configuration | |
sass: { | |
dist: { | |
files: [{ | |
expand: true, // enable dynamic expansion | |
cwd: '../src/scss/', | |
src: ['**/*.scss'], | |
dest: '../assets/css/', | |
ext: '.min.css', // dest filepaths will have this extension | |
extDot: 'first', // extensions in filenames begin after the first dot | |
}], | |
options: { | |
style: 'compressed' | |
}, | |
}, | |
}, | |
// Uglify task configuration | |
uglify: { | |
my_target: { | |
files: [{ | |
expand: true, // enable dynamic expansion | |
cwd: '../src/js/', | |
src: ['**/*.js'], | |
dest: '../assets/js/', | |
ext: '.min.js', // dest filepaths will have this extension | |
extDot: 'last', // extensions in filenames begin after the last dot | |
}], | |
}, | |
}, | |
// Imagemin task configuration | |
imagemin: { | |
dynamic: { | |
files: [{ | |
expand: true, // enable dynamic expansion | |
cwd: '../src/img/', | |
src: ['**/*.{png,jpg,gif}'], | |
dest: '../assets/img/', | |
}], | |
}, | |
}, | |
}); | |
// Load Plug-ins | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-imagemin'); | |
// Register Tasks: used as commands | |
grunt.registerTask('build-sass', ['sass', 'watch']); | |
grunt.registerTask('build-uglify', ['uglify', 'watch']); | |
grunt.registerTask('build-imagemin', ['imagemin', 'watch']); | |
grunt.registerTask('default', ['sass', 'uglify', 'imagemin', 'watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment