Revision: 64107
Updated Code
at July 5, 2013 02:24 by rickygri
Updated Code
module.exports = function (grunt) {
/*
Grunt installation:
-------------------
npm install -g grunt-cli
npm install -g grunt-init
npm init (creates a `package.json` file)
Project Dependencies:
---------------------
npm install grunt --save-dev
npm install grunt-contrib-watch --save-dev
npm install grunt-contrib-jshint --save-dev
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-requirejs --save-dev
npm install grunt-contrib-sass --save-dev
npm install grunt-contrib-imagemin --save-dev
npm install grunt-contrib-htmlmin --save-dev
npm install grunt-contrib-connect --save-dev
npm install grunt-contrib-jasmine --save-dev
npm install grunt-template-jasmine-requirejs --save-dev
*/
// Project configuration.
grunt.initConfig({
// Store your Package file so you can reference its specific data whenever necessary
pkg: grunt.file.readJSON('package.json'),
// Used to connect to a locally running web server (so Jasmine can test against a DOM)
connect: {
test: {
port: 8000
}
},
jasmine: {
/*
Note:
In case there is a /release/ directory found, we don't want to run tests on that
so we use the ! (bang) operator to ignore the specified directory
*/
src: ['app/**/*.js', '!app/release/**'],
options: {
host: 'http://127.0.0.1:8000/',
specs: 'specs/**/*Spec.js',
helpers: ['specs/helpers/*Helper.js', 'specs/helpers/sinon.js'],
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
baseUrl: './app/',
mainConfigFile: './app/main.js'
}
}
}
},
jshint: {
/*
Note:
In case there is a /release/ directory found, we don't want to lint that
so we use the ! (bang) operator to ignore the specified directory
*/
files: ['Gruntfile.js', 'app/**/*.js', '!app/release/**', 'modules/**/*.js', 'specs/**/*Spec.js'],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true,
globals: {
// AMD
module: true,
require: true,
requirejs: true,
define: true,
// Environments
console: true,
// General Purpose Libraries
$: true,
jQuery: true,
// Testing
sinon: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true
}
}
},
requirejs: {
compile: {
options: {
baseUrl: './app',
mainConfigFile: './app/main.js',
dir: './app/release/',
fileExclusionRegExp: /^\.|node_modules|Gruntfile|\.md|package.json/,
// optimize: 'none',
modules: [
{
name: 'main'
// include: ['module'],
// exclude: ['module']
}
]
}
}
},
sass: {
dist: {
options: {
style: 'compressed',
require: ['./assets/styles/sass/helpers/url64.rb']
},
expand: true,
cwd: './app/styles/sass/',
src: ['*.scss'],
dest: './app/styles/',
ext: '.css'
},
dev: {
options: {
style: 'expanded',
debugInfo: true,
lineNumbers: true,
require: ['./app/styles/sass/helpers/url64.rb']
},
expand: true,
cwd: './app/styles/sass/',
src: ['*.scss'],
dest: './app/styles/',
ext: '.css'
}
},
// `optimizationLevel` is only applied to PNG files (not JPG)
imagemin: {
png: {
options: {
optimizationLevel: 7
},
files: [
{
expand: true,
cwd: './app/images/',
src: ['**/*.png'],
dest: './app/images/compressed/',
ext: '.png'
}
]
},
jpg: {
options: {
progressive: true
},
files: [
{
expand: true,
cwd: './app/images/',
src: ['**/*.jpg'],
dest: './app/images/compressed/',
ext: '.jpg'
}
]
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
removeEmptyAttributes: true,
removeCommentsFromCDATA: true,
removeRedundantAttributes: true,
collapseBooleanAttributes: true
},
files: {
// Destination : Source
'./index-min.html': './index.html'
}
}
},
// Run: `grunt watch` from command line for this section to take effect
watch: {
files: ['<%= jshint.files %>', '<%= jasmine.options.specs %>', '<%= sass.dev.src %>'],
tasks: 'default'
}
});
// Load NPM Tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jasmine');
// Default Task
grunt.registerTask('default', ['jshint', 'connect', 'jasmine', 'sass:dev']);
// Unit Testing Task
grunt.registerTask('test', ['connect', 'jasmine']);
// Release Task
grunt.registerTask('release', ['jshint', 'jasmine', 'requirejs', 'sass:dist', 'imagemin', 'htmlmin']);
};
Revision: 64106
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 5, 2013 02:07 by rickygri
Initial Code
npm install grunt --save-dev npm install grunt-contrib-watch --save-dev npm install grunt-contrib-jshint --save-dev npm install grunt-contrib-uglify --save-dev npm install grunt-contrib-requirejs --save-dev npm install grunt-contrib-sass --save-dev npm install grunt-contrib-imagemin --save-dev npm install grunt-contrib-htmlmin --save-dev npm install grunt-contrib-connect --save-dev npm install grunt-contrib-jasmine --save-dev npm install grunt-template-jasmine-requirejs --save-dev
Initial URL
http://integralist.co.uk/Grunt-Boilerplate.html
Initial Description
Copypasta boilerplate for command prompt node install
Initial Title
Grunt boilerplate
Initial Tags
Initial Language
JavaScript