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