Skip to content

Instantly share code, notes, and snippets.

@brayhoward
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brayhoward/52ed7472202a3c69103b to your computer and use it in GitHub Desktop.
Save brayhoward/52ed7472202a3c69103b to your computer and use it in GitHub Desktop.
Grunt file that compiles jade and sass, watches, serves, and builds. && index.jade boilerplate
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jade": "^0.14.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-sass": "^0.18.1",
"load-grunt-tasks": "^3.1.0"
}
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
jade: {
compile: {
options: {
pretty: true,
data: {
debug: false
}
},
files: [{
expand: true,
cwd: 'app',
src: ['**/*.jade', '!**/_*.jade'],
dest: 'public',
ext: '.html'
}]
}
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'public/css/main.css': 'app/styles/main.scss'
}
}
},
connect: {
options: {
port: 3333,
base: 'public',
hostname: 'localhost',
useAvailablePort: true,
open: true
},
server: {
options: {
livereload: true
}
}
},
watch: {
configFiles: {
files: ['Gruntfile.js', 'bower.json', 'package.json'],
options: {
reload: true
}
},
other: {
files: ['app/**', '!app/**/*.jade', '!app/partials/**', '!app/styles/**', '!app/scripts/**',],
tasks: ['copy']
},
livereload: {
options: { livereload: true },
files: ['public/{,*/}*.{html,css,js}']
},
jade: {
files: ['app/**/*.jade'],
tasks: ['jade']
},
sass: {
files: ['app/styles/{,*/}*.{scss,sass}'],
tasks: ['sass']
}
},
copy: {
main: {
files: [
{expand: true, cwd: 'app', src: ['**', '!**/*.jade', '!partials/**', '!styles/**', '!scripts/**'], dest: 'public'},
{expand: true, cwd: 'bower_components', src: ['**'], dest: 'public/vendor'}
]
}
},
clean: ['public']
});
grunt.registerTask('build', ['clean', 'copy', 'sass', 'jade']);
grunt.registerTask('serve', ['build', 'connect:server', 'watch']);
grunt.registerTask('default', []);
};
<!DOCTYPE html>
html(lang="en")
head
meta(charset="utf-8")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="width=device-width, initial-scale=1")
title C.A.Humanity
link(rel="stylesheet" href="/vendor/normalize.css/normalize.css")
link(rel="stylesheet" href="/vendor/bootstrap/dist/css/bootstrap.min.css")
link(rel="stylesheet" href="css/main.css")
body
h1 Hello World
button.btn.btn-primary Push here
script(src="/vendor/jquery/dist/jquery.min.js")
script(src="/vendor/bootstrap/dist/js/bootstrap.min.js")
script(src="/vendor/firebase/firebase.js")
script(src="/vendor/angular/angular.min.js")
script(src="/vendor/angular-route/angular-route.min.js")
script(src="js/app.js")
script(src="js/services.js")
script(src="js/controllers.js")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment