Created
February 27, 2014 15:44
-
-
Save ftsanjuan/9252622 to your computer and use it in GitHub Desktop.
A base Gruntfile and package.json setup that minifies js files, compiles sass files and sets up watch on a base folder (app/)
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.initConfig({ | |
// concatenates all your js files | |
concat: { | |
js: { | |
src: ['app/app.js', 'app/js/**/**.js'], | |
dest: 'tmp/app.js' | |
} | |
}, | |
// minifies your js files | |
uglify: { | |
options: { | |
mangle: false, | |
uglify: true | |
}, | |
default: { | |
files: { | |
"app.min.js": ["tmp/app.js"] | |
} | |
} | |
}, | |
// compile sass files to css | |
sass: { | |
dist: { | |
options: { | |
style: 'expanded' | |
}, | |
files: { | |
'css/style.css': 'app/sass/app.scss' | |
} | |
} | |
}, | |
// watches for changes in project, reloads browser | |
watch: { | |
options: { | |
livereload: true | |
}, | |
files: ['app/**/*', 'app/**/**/*', 'index.html'], | |
tasks: ['concat:js', 'sass', 'uglify'], | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
// The default tasks to run when you type 'grunt' | |
grunt.registerTask('default', ['watch']); | |
}; |
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
{ | |
"name": "Base App", | |
"title": "baseApp", | |
"version": "1.0.0", | |
"devDependencies": { | |
"grunt": "0.4.2", | |
"grunt-contrib-concat": "0.3.0", | |
"grunt-contrib-watch" : "0.5.3", | |
"grunt-contrib-uglify" : "0.2.2", | |
"grunt-contrib-sass": "0.7.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment