]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - Gruntfile.js
Add nodejs 5.1 to travis tests
[github/Chocobozzz/PeerTube.git] / Gruntfile.js
CommitLineData
8c308c2b
C
1'use strict'
2
3module.exports = function (grunt) {
4 var paths = {
5 dist: 'dist',
8c308c2b
C
6 jade: 'views/**/**/*.jade',
7 css: 'public/stylesheets/*.css',
e5e7517b 8 scss: 'public/stylesheets/*.scss',
8c308c2b
C
9 vendor: 'public/stylesheets/vendor',
10 js: 'public/javascripts/*.js',
11 src: 'src/*.js',
12 routes: 'routes/**/*.js',
13 main: './server.js',
14 browserified: 'public/javascripts/bundle.js',
15 img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}',
16 test: 'tests',
17 server: 'server.js'
18 }
19
20 require('time-grunt')(grunt)
21
22 // Project Configuration
23 grunt.initConfig({
24 paths: paths,
25 pkg: grunt.file.readJSON('package.json'),
26 browserify: {
27 dev: {
28 src: [ paths.js, '!public/javascripts/bundle.js' ],
29 dest: paths.browserified,
30 options: {
31 browserifyOptions: { 'debug': true },
32 watch: true
33 }
8c308c2b
C
34 }
35 },
36 copy: {
37 dev: {
e5e7517b
C
38 cwd: 'node_modules/bootstrap-sass/assets/',
39 src: [ 'fonts/bootstrap/*' ],
8c308c2b
C
40 expand: true,
41 dest: paths.vendor
42 }
43 },
44 clean: {
45 dev: {
46 files: [{
47 dot: true,
48 src: [
e5e7517b 49 paths.browserified, 'public/stylesheets/global.css', paths.vendor
8c308c2b
C
50 ]
51 }]
8c308c2b
C
52 }
53 },
8c308c2b
C
54 express: {
55 dev: {
56 options: {
57 script: paths.server,
58 harmony: true,
59 port: 9000,
60 node_env: 'development',
61 debug: true,
62 background: true
63 }
8c308c2b
C
64 }
65 },
e5e7517b
C
66 sass: {
67 dev: {
68 files: {
69 'public/stylesheets/global.css': paths.scss
70 }
71 }
72 },
8c308c2b
C
73 watch: {
74 express: {
75 files: [ paths.main, paths.routes, paths.src ],
76 tasks: [ 'express:dev' ],
77 options: {
78 livereload: true,
79 spawn: false
80 }
81 },
82 dev: {
83 files: [ paths.jade, paths.css, paths.browserified ],
84 options: {
85 livereload: true,
86 nospawn: false
87 }
88 }
89 }
90 })
91
92 // Build client javascript and copy bootstrap dependencies
93 grunt.registerTask('build', [], function () {
e5e7517b 94 grunt.loadNpmTasks('grunt-sass')
8c308c2b
C
95 grunt.loadNpmTasks('grunt-browserify')
96 grunt.loadNpmTasks('grunt-contrib-copy')
97 grunt.loadNpmTasks('grunt-newer')
98
e5e7517b 99 // TODO: SASS --> newer
8c308c2b 100 grunt.task.run(
e5e7517b 101 'sass:dev',
8c308c2b
C
102 'newer:browserify:dev',
103 'newer:copy:dev'
104 )
105 })
106
107 // Start in dev mode (reload front end files without refresh)
108 grunt.registerTask('dev', [], function () {
e5e7517b 109 grunt.loadNpmTasks('grunt-sass')
8c308c2b
C
110 grunt.loadNpmTasks('grunt-browserify')
111 grunt.loadNpmTasks('grunt-contrib-watch')
112 grunt.loadNpmTasks('grunt-express-server')
113 grunt.loadNpmTasks('grunt-contrib-copy')
114 grunt.loadNpmTasks('grunt-newer')
115
e5e7517b 116 // TODO: SASS --> newer
8c308c2b 117 grunt.task.run(
e5e7517b 118 'sass:dev',
8c308c2b
C
119 'newer:browserify:dev',
120 'newer:copy:dev',
121 'express:dev',
122 'watch'
123 )
124 })
125
8c308c2b
C
126 // Clean build
127 grunt.registerTask('clean', [], function () {
128 grunt.loadNpmTasks('grunt-contrib-clean')
129
130 grunt.task.run(
9d640786 131 'clean:dev'
8c308c2b
C
132 )
133 })
134}