]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - Gruntfile.js
Split models
[github/Chocobozzz/PeerTube.git] / Gruntfile.js
index df7958c4f72f7b1188d1b2d797ac794e52e642b2..6df0c023aa942e9a608eb4de2049e2c475ecc251 100644 (file)
@@ -5,11 +5,10 @@ module.exports = function (grunt) {
     dist: 'dist',
     jade: 'views/**/**/*.jade',
     css: 'public/stylesheets/*.css',
-    scss: 'public/stylesheets/*.scss',
+    scss: 'public/stylesheets/application.scss',
     vendor: 'public/stylesheets/vendor',
     js: 'public/javascripts/*.js',
-    src: 'src/*.js',
-    routes: 'routes/**/*.js',
+    routes: 'controllers/**/*.js',
     main: './server.js',
     browserified: 'public/javascripts/bundle.js',
     img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}',
@@ -33,6 +32,12 @@ module.exports = function (grunt) {
         }
       }
     },
+    concurrent: {
+      options: {
+        logConcurrentOutput: true
+      },
+      dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
+    },
     copy: {
       dev: {
         cwd: 'node_modules/bootstrap-sass/assets/',
@@ -59,11 +64,14 @@ module.exports = function (grunt) {
           port: 9000,
           node_env: 'development',
           debug: true,
-          background: true
+          background: false
         }
       }
     },
     sass: {
+      options: {
+        includePaths: [ 'node_modules/bootstrap-sass/assets/stylesheets/' ]
+      },
       dev: {
         files: {
           'public/stylesheets/global.css': paths.scss
@@ -71,57 +79,28 @@ module.exports = function (grunt) {
       }
     },
     watch: {
-      express: {
-        files: [ paths.main, paths.routes, paths.src ],
-        tasks: [ 'express:dev' ],
-        options: {
-          livereload: true,
-          spawn: false
-        }
-      },
-      dev: {
+      livereload: {
         files: [ paths.jade, paths.css, paths.browserified ],
+        tasks: [ ],
         options: {
-          livereload: true,
-          nospawn: false
+          livereload: true
         }
+      },
+      sass: {
+        files: [ paths.scss ],
+        tasks: [ 'sass:dev' ]
       }
     }
   })
 
-  // Build client javascript and copy bootstrap dependencies
-  grunt.registerTask('build', [], function () {
-    grunt.loadNpmTasks('grunt-sass')
-    grunt.loadNpmTasks('grunt-browserify')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
+  // Load automatically all the tasks
+  require('load-grunt-tasks')(grunt)
 
-    // TODO: SASS --> newer
-    grunt.task.run(
-      'sass:dev',
-      'newer:browserify:dev',
-      'newer:copy:dev'
-    )
-  })
+  // Build client javascript and copy bootstrap dependencies
+  grunt.registerTask('build', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev' ])
 
   // Start in dev mode (reload front end files without refresh)
-  grunt.registerTask('dev', [], function () {
-    grunt.loadNpmTasks('grunt-sass')
-    grunt.loadNpmTasks('grunt-browserify')
-    grunt.loadNpmTasks('grunt-contrib-watch')
-    grunt.loadNpmTasks('grunt-express-server')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
-
-    // TODO: SASS --> newer
-    grunt.task.run(
-      'sass:dev',
-      'newer:browserify:dev',
-      'newer:copy:dev',
-      'express:dev',
-      'watch'
-    )
-  })
+  grunt.registerTask('dev', [ 'sass:dev', 'newer:browserify:dev', 'newer:copy:dev', 'concurrent:dev' ])
 
   // Clean build
   grunt.registerTask('clean', [], function () {