PeerTube/Gruntfile.js

114 lines
2.6 KiB
JavaScript
Raw Normal View History

2015-06-09 10:41:40 -05:00
'use strict'
module.exports = function (grunt) {
var paths = {
dist: 'dist',
jade: 'views/**/**/*.jade',
css: 'public/stylesheets/*.css',
2015-12-05 05:14:55 -06:00
scss: 'public/stylesheets/application.scss',
2015-06-09 10:41:40 -05:00
vendor: 'public/stylesheets/vendor',
js: 'public/javascripts/*.js',
2016-01-30 10:05:22 -06:00
routes: 'controllers/**/*.js',
2015-06-09 10:41:40 -05:00
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 15:16:22 -06:00
concurrent: {
options: {
logConcurrentOutput: true
},
dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
},
2015-06-09 10:41:40 -05:00
copy: {
dev: {
2015-11-22 04:34:48 -06:00
cwd: 'node_modules/bootstrap-sass/assets/',
src: [ 'fonts/bootstrap/*' ],
2015-06-09 10:41:40 -05:00
expand: true,
dest: paths.vendor
}
},
clean: {
dev: {
files: [{
dot: true,
src: [
2015-11-22 04:34:48 -06:00
paths.browserified, 'public/stylesheets/global.css', paths.vendor
2015-06-09 10:41:40 -05:00
]
}]
}
},
express: {
dev: {
options: {
script: paths.server,
harmony: true,
port: 9000,
node_env: 'development',
debug: true,
2015-12-02 15:16:22 -06:00
background: false
2015-06-09 10:41:40 -05:00
}
}
},
2015-11-22 04:34:48 -06:00
sass: {
options: {
includePaths: [ 'node_modules/bootstrap-sass/assets/stylesheets/' ]
},
2015-11-22 04:34:48 -06:00
dev: {
files: {
'public/stylesheets/global.css': paths.scss
}
}
},
2015-06-09 10:41:40 -05:00
watch: {
2015-12-02 15:16:22 -06:00
livereload: {
2015-06-09 10:41:40 -05:00
files: [ paths.jade, paths.css, paths.browserified ],
2015-12-02 15:16:22 -06:00
tasks: [ ],
2015-06-09 10:41:40 -05:00
options: {
2015-12-02 15:16:22 -06:00
livereload: true
2015-06-09 10:41:40 -05:00
}
2015-12-02 15:16:22 -06:00
},
sass: {
files: [ paths.scss ],
tasks: [ 'sass:dev' ]
2015-06-09 10:41:40 -05:00
}
}
})
2015-12-02 15:16:22 -06:00
// Load automatically all the tasks
require('load-grunt-tasks')(grunt)
2015-06-09 10:41:40 -05:00
2015-12-02 15:16:22 -06:00
// Build client javascript and copy bootstrap dependencies
grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ])
2015-06-09 10:41:40 -05:00
// Start in dev mode (reload front end files without refresh)
2015-12-02 15:16:22 -06:00
grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ])
2015-06-09 10:41:40 -05:00
// Clean build
grunt.registerTask('clean', [], function () {
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.task.run(
2015-11-02 15:59:13 -06:00
'clean:dev'
2015-06-09 10:41:40 -05:00
)
})
}