Skip to content

Instantly share code, notes, and snippets.

@kvendrik
Last active August 29, 2015 14:06
Show Gist options
  • Save kvendrik/240d8b3352e8a54b7975 to your computer and use it in GitHub Desktop.
Save kvendrik/240d8b3352e8a54b7975 to your computer and use it in GitHub Desktop.
Simple Grunt boilerplate
module.exports = function (grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
appRoot: 'app',
connect: {
server: {
options: {
livereload: true,
hostname: '127.0.0.1',
port: 9000,
base: '<%= appRoot %>/'
}
}
},
open: {
all: {
path: 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>'
}
},
watch: {
options: {
livereload: true,
},
html: {
files: ['<%= appRoot %>/*.html']
},
js: {
files: ['<%= appRoot %>/js/src/*.js'],
tasks: ['concat']
},
sass: {
files: ['<%= appRoot %>/sass/*.scss'],
tasks: ['sass']
}
},
sass: {
dist: {
files: {
'<%= appRoot %>/css/main.css': '<%= appRoot %>/sass/main.scss'
}
}
},
concat: {
options: {
separator: '\n\n',
},
js: {
src: ['<%= appRoot %>/fonts/ss-pika/ss-pika.js', '<%= appRoot %>/js/libs/*.js', '<%= appRoot %>/js/src/*.js'],
dest: '<%= appRoot %>/js/app.js'
}
},
uglify: {
js: {
files: {
'<%= appRoot %>/js/app.min.js': ['<%= appRoot %>/fonts/ss-pika/ss-pika.js', '<%= appRoot %>/js/libs/*.js', '<%= appRoot %>/js/src/*.js']
}
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('serve', ['connect', 'open', 'watch']);
grunt.registerTask('build', ['sass', 'uglify']);
}
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "GruntFile.js",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.4",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-sass": "~0.7.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-open": "~0.2.3",
"load-grunt-tasks": "~0.4.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Koen Vendrik",
"license": "BSD 2-Clause"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment