PeerTube/Gruntfile.js

115 lines
2.6 KiB
JavaScript
Raw Normal View History

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