Created
October 15, 2013 05:18
-
-
Save bcherny/6986859 to your computer and use it in GitHub Desktop.
Gruntfile for compiling and minifying dependency-free coffeescripts. Names the file after its current directory.
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) -> | |
nameParts = __dirname.split '/' | |
name = nameParts[nameParts.length - 1] | |
config = | |
pkg: 'package.json' | |
coffee: | |
compile: | |
files: {} | |
uglify: | |
options: | |
mangle: | |
toplevel: true | |
compress: | |
dead_code: true | |
unused: true | |
join_vars: true | |
comments: false | |
standard: | |
files: {} | |
# configure coffee, uglify | |
config.coffee.compile.files[name + '.js'] = name + '.coffee' | |
config.uglify.standard.files[name + '.min.js'] = [name + '.js'] | |
# load config | |
grunt.config.init config | |
# load tasks | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-uglify' | |
# register tasks | |
grunt.registerTask 'default', ['coffee', 'uglify'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment