Skip to content

Instantly share code, notes, and snippets.

@wchan2
Last active August 29, 2015 14:08
Show Gist options
  • Save wchan2/6e79a5c421aed796d5fb to your computer and use it in GitHub Desktop.
Save wchan2/6e79a5c421aed796d5fb to your computer and use it in GitHub Desktop.
Gruntfiles
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.pyc
pids
logs
results
npm-debug.log
node_modules
.grunt/*
_SpecRunner.html

Download Files

Using the wget commands to download a pre-made Gruntfile and package.json

wget https://gist.githubusercontent.com/wchan2/6e79a5c421aed796d5fb/raw/d6d73e95f5ab35407ad5f4d56ab8173f8d1c189b/.gitignore
wget https://gist.githubusercontent.com/wchan2/6e79a5c421aed796d5fb/raw/0bdca411ebacaca60414a21493f1f9e462e5c1b7/Gruntfile.js
wget https://gist.githubusercontent.com/wchan2/6e79a5c421aed796d5fb/raw/695c860780894f9347a7255e368b42df78f63a52/package.json
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['path/to/src/*.js'],
dest: 'path/to/dist/*.js'
}
},
uglify: {
dist: {
files: {
'path/to/dist/*-min.js': ['<%= concat.dist.dest %>']
}
}
},
jasmine: {
src: 'src/**/*.js',
options: {
specs: 'specs/*-spec.js',
template: require('grunt-template-jasmine-requirejs')
}
},
jshint: {
files: ['src/**/*.js'],
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
files: ['<%= jshint.files %>', '<%= jasmine.options.specs %>'],
tasks: ['jshint', 'jasmine']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('test', ['jshint', 'jasmine']);
grunt.registerTask('build', ['concat', 'uglify'])
grunt.registerTask('default', ['jshint', 'jasmine', 'concat', 'uglify']);
};
{
"name": "<insert name here>",
"version": "<insert version here>",
"description": "<insert description here>",
"main": "<main javascript file here>",
"devDependencies": {
"grunt": "0.4.2",
"grunt-contrib-uglify": "0.3.2",
"grunt-contrib-jasmine": "0.5.2",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-watch": "0.5.3",
"grunt-contrib-jshint": "0.8.0",
"grunt-template-jasmine-requirejs": "0.1.9"
},
"scripts": {
"preinstall": "npm install -g grunt-cli"
},
"repository": "",
"author": "William Chan",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment