2015-06-09 11:41:40 -04:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
var paths = {
|
|
|
|
dist: 'dist',
|
|
|
|
jade: 'views/**/**/*.jade',
|
|
|
|
css: 'public/stylesheets/*.css',
|
2015-11-22 05:34:48 -05:00
|
|
|
scss: 'public/stylesheets/*.scss',
|
2015-06-09 11:41:40 -04:00
|
|
|
vendor: 'public/stylesheets/vendor',
|
|
|
|
js: 'public/javascripts/*.js',
|
|
|
|
src: 'src/*.js',
|
|
|
|
routes: 'routes/**/*.js',
|
|
|
|
main: './server.js',
|
|
|
|
browserified: 'public/javascripts/bundle.js',
|
|
|
|
img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}',
|
|
|
|
test: 'tests',
|
|
|
|
server: 'server.js'
|
|
|
|
}
|
|
|
|
|
|
|
|
require('time-grunt')(grunt)
|
|
|
|
|
|
|
|
// Project Configuration
|
|
|
|
grunt.initConfig({
|
|
|
|
paths: paths,
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
browserify: {
|
|
|
|
dev: {
|
|
|
|
src: [ paths.js, '!public/javascripts/bundle.js' ],
|
|
|
|
dest: paths.browserified,
|
|
|
|
options: {
|
|
|
|
browserifyOptions: { 'debug': true },
|
|
|
|
watch: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-12-02 16:16:22 -05:00
|
|
|
concurrent: {
|
|
|
|
options: {
|
|
|
|
logConcurrentOutput: true
|
|
|
|
},
|
|
|
|
dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
|
|
|
|
},
|
2015-06-09 11:41:40 -04:00
|
|
|
copy: {
|
|
|
|
dev: {
|
2015-11-22 05:34:48 -05:00
|
|
|
cwd: 'node_modules/bootstrap-sass/assets/',
|
|
|
|
src: [ 'fonts/bootstrap/*' ],
|
2015-06-09 11:41:40 -04:00
|
|
|
expand: true,
|
|
|
|
dest: paths.vendor
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
dev: {
|
|
|
|
files: [{
|
|
|
|
dot: true,
|
|
|
|
src: [
|
2015-11-22 05:34:48 -05:00
|
|
|
paths.browserified, 'public/stylesheets/global.css', paths.vendor
|
2015-06-09 11:41:40 -04:00
|
|
|
]
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
express: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
script: paths.server,
|
|
|
|
harmony: true,
|
|
|
|
port: 9000,
|
|
|
|
node_env: 'development',
|
|
|
|
debug: true,
|
2015-12-02 16:16:22 -05:00
|
|
|
background: false
|
2015-06-09 11:41:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-11-22 05:34:48 -05:00
|
|
|
sass: {
|
2015-12-04 10:17:46 -05:00
|
|
|
options: {
|
|
|
|
includePaths: [ 'node_modules/bootstrap-sass/assets/stylesheets/' ]
|
|
|
|
},
|
2015-11-22 05:34:48 -05:00
|
|
|
dev: {
|
|
|
|
files: {
|
|
|
|
'public/stylesheets/global.css': paths.scss
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-06-09 11:41:40 -04:00
|
|
|
watch: {
|
2015-12-02 16:16:22 -05:00
|
|
|
livereload: {
|
2015-06-09 11:41:40 -04:00
|
|
|
files: [ paths.jade, paths.css, paths.browserified ],
|
2015-12-02 16:16:22 -05:00
|
|
|
tasks: [ ],
|
2015-06-09 11:41:40 -04:00
|
|
|
options: {
|
2015-12-02 16:16:22 -05:00
|
|
|
livereload: true
|
2015-06-09 11:41:40 -04:00
|
|
|
}
|
2015-12-02 16:16:22 -05:00
|
|
|
},
|
|
|
|
sass: {
|
|
|
|
files: [ paths.scss ],
|
|
|
|
tasks: [ 'sass:dev' ]
|
2015-06-09 11:41:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2015-12-02 16:16:22 -05:00
|
|
|
// Load automatically all the tasks
|
|
|
|
require('load-grunt-tasks')(grunt)
|
2015-06-09 11:41:40 -04:00
|
|
|
|
2015-12-02 16:16:22 -05:00
|
|
|
// Build client javascript and copy bootstrap dependencies
|
|
|
|
grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ])
|
2015-06-09 11:41:40 -04:00
|
|
|
|
|
|
|
// Start in dev mode (reload front end files without refresh)
|
2015-12-02 16:16:22 -05:00
|
|
|
grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ])
|
2015-06-09 11:41:40 -04:00
|
|
|
|
|
|
|
// Clean build
|
|
|
|
grunt.registerTask('clean', [], function () {
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean')
|
|
|
|
|
|
|
|
grunt.task.run(
|
2015-11-02 16:59:13 -05:00
|
|
|
'clean:dev'
|
2015-06-09 11:41:40 -04:00
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|