]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - Gruntfile.js
Add a pool of requests instead of making a request at each action (add
[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 },
af82cae0
C
36 concurrent: {
37 options: {
38 logConcurrentOutput: true
39 },
40 dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
41 },
8c308c2b
C
42 copy: {
43 dev: {
e5e7517b
C
44 cwd: 'node_modules/bootstrap-sass/assets/',
45 src: [ 'fonts/bootstrap/*' ],
8c308c2b
C
46 expand: true,
47 dest: paths.vendor
48 }
49 },
50 clean: {
51 dev: {
52 files: [{
53 dot: true,
54 src: [
e5e7517b 55 paths.browserified, 'public/stylesheets/global.css', paths.vendor
8c308c2b
C
56 ]
57 }]
8c308c2b
C
58 }
59 },
8c308c2b
C
60 express: {
61 dev: {
62 options: {
63 script: paths.server,
64 harmony: true,
65 port: 9000,
66 node_env: 'development',
67 debug: true,
af82cae0 68 background: false
8c308c2b 69 }
8c308c2b
C
70 }
71 },
e5e7517b
C
72 sass: {
73 dev: {
74 files: {
75 'public/stylesheets/global.css': paths.scss
76 }
77 }
78 },
8c308c2b 79 watch: {
af82cae0 80 livereload: {
8c308c2b 81 files: [ paths.jade, paths.css, paths.browserified ],
af82cae0 82 tasks: [ ],
8c308c2b 83 options: {
af82cae0 84 livereload: true
8c308c2b 85 }
af82cae0
C
86 },
87 sass: {
88 files: [ paths.scss ],
89 tasks: [ 'sass:dev' ]
8c308c2b
C
90 }
91 }
92 })
93
af82cae0
C
94 // Load automatically all the tasks
95 require('load-grunt-tasks')(grunt)
8c308c2b 96
af82cae0
C
97 // Build client javascript and copy bootstrap dependencies
98 grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ])
8c308c2b
C
99
100 // Start in dev mode (reload front end files without refresh)
af82cae0 101 grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ])
8c308c2b 102
8c308c2b
C
103 // Clean build
104 grunt.registerTask('clean', [], function () {
105 grunt.loadNpmTasks('grunt-contrib-clean')
106
107 grunt.task.run(
9d640786 108 'clean:dev'
8c308c2b
C
109 )
110 })
111}