]>
Commit | Line | Data |
---|---|---|
8c308c2b C |
1 | 'use strict' |
2 | ||
3 | module.exports = function (grunt) { | |
4 | var paths = { | |
5 | dist: 'dist', | |
8c308c2b C |
6 | jade: 'views/**/**/*.jade', |
7 | css: 'public/stylesheets/*.css', | |
0ac5edd9 | 8 | scss: 'public/stylesheets/application.scss', |
8c308c2b C |
9 | vendor: 'public/stylesheets/vendor', |
10 | js: 'public/javascripts/*.js', | |
cda02107 | 11 | routes: 'controllers/**/*.js', |
8c308c2b C |
12 | main: './server.js', |
13 | browserified: 'public/javascripts/bundle.js', | |
14 | img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}', | |
15 | test: 'tests', | |
16 | server: 'server.js' | |
17 | } | |
18 | ||
19 | require('time-grunt')(grunt) | |
20 | ||
21 | // Project Configuration | |
22 | grunt.initConfig({ | |
23 | paths: paths, | |
24 | pkg: grunt.file.readJSON('package.json'), | |
25 | browserify: { | |
26 | dev: { | |
27 | src: [ paths.js, '!public/javascripts/bundle.js' ], | |
28 | dest: paths.browserified, | |
29 | options: { | |
30 | browserifyOptions: { 'debug': true }, | |
31 | watch: true | |
32 | } | |
8c308c2b C |
33 | } |
34 | }, | |
af82cae0 C |
35 | concurrent: { |
36 | options: { | |
37 | logConcurrentOutput: true | |
38 | }, | |
39 | dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ] | |
40 | }, | |
8c308c2b C |
41 | copy: { |
42 | dev: { | |
e5e7517b C |
43 | cwd: 'node_modules/bootstrap-sass/assets/', |
44 | src: [ 'fonts/bootstrap/*' ], | |
8c308c2b C |
45 | expand: true, |
46 | dest: paths.vendor | |
47 | } | |
48 | }, | |
49 | clean: { | |
50 | dev: { | |
51 | files: [{ | |
52 | dot: true, | |
53 | src: [ | |
e5e7517b | 54 | paths.browserified, 'public/stylesheets/global.css', paths.vendor |
8c308c2b C |
55 | ] |
56 | }] | |
8c308c2b C |
57 | } |
58 | }, | |
8c308c2b C |
59 | express: { |
60 | dev: { | |
61 | options: { | |
62 | script: paths.server, | |
63 | harmony: true, | |
64 | port: 9000, | |
65 | node_env: 'development', | |
66 | debug: true, | |
af82cae0 | 67 | background: false |
8c308c2b | 68 | } |
8c308c2b C |
69 | } |
70 | }, | |
e5e7517b | 71 | sass: { |
c1580271 C |
72 | options: { |
73 | includePaths: [ 'node_modules/bootstrap-sass/assets/stylesheets/' ] | |
74 | }, | |
e5e7517b C |
75 | dev: { |
76 | files: { | |
77 | 'public/stylesheets/global.css': paths.scss | |
78 | } | |
79 | } | |
80 | }, | |
8c308c2b | 81 | watch: { |
af82cae0 | 82 | livereload: { |
8c308c2b | 83 | files: [ paths.jade, paths.css, paths.browserified ], |
af82cae0 | 84 | tasks: [ ], |
8c308c2b | 85 | options: { |
af82cae0 | 86 | livereload: true |
8c308c2b | 87 | } |
af82cae0 C |
88 | }, |
89 | sass: { | |
90 | files: [ paths.scss ], | |
91 | tasks: [ 'sass:dev' ] | |
8c308c2b C |
92 | } |
93 | } | |
94 | }) | |
95 | ||
af82cae0 C |
96 | // Load automatically all the tasks |
97 | require('load-grunt-tasks')(grunt) | |
8c308c2b | 98 | |
af82cae0 C |
99 | // Build client javascript and copy bootstrap dependencies |
100 | grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ]) | |
8c308c2b C |
101 | |
102 | // Start in dev mode (reload front end files without refresh) | |
af82cae0 | 103 | grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ]) |
8c308c2b | 104 | |
8c308c2b C |
105 | // Clean build |
106 | grunt.registerTask('clean', [], function () { | |
107 | grunt.loadNpmTasks('grunt-contrib-clean') | |
108 | ||
109 | grunt.task.run( | |
9d640786 | 110 | 'clean:dev' |
8c308c2b C |
111 | ) |
112 | }) | |
113 | } |