]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - Gruntfile.js
Move require outside the function
[github/Chocobozzz/PeerTube.git] / Gruntfile.js
index fa0c2026c1cac691a8e6e546e196c975c200de43..6df0c023aa942e9a608eb4de2049e2c475ecc251 100644 (file)
@@ -5,10 +5,10 @@ module.exports = function (grunt) {
     dist: 'dist',
     jade: 'views/**/**/*.jade',
     css: 'public/stylesheets/*.css',
+    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}',
@@ -32,10 +32,16 @@ module.exports = function (grunt) {
         }
       }
     },
+    concurrent: {
+      options: {
+        logConcurrentOutput: true
+      },
+      dev: [ 'watch:livereload', 'watch:sass', 'express:dev' ]
+    },
     copy: {
       dev: {
-        cwd: 'node_modules/bootstrap/dist/',
-        src: [ 'css/*', 'fonts/*' ],
+        cwd: 'node_modules/bootstrap-sass/assets/',
+        src: [ 'fonts/bootstrap/*' ],
         expand: true,
         dest: paths.vendor
       }
@@ -45,7 +51,7 @@ module.exports = function (grunt) {
         files: [{
           dot: true,
           src: [
-            paths.browserified
+            paths.browserified, 'public/stylesheets/global.css', paths.vendor
           ]
         }]
       }
@@ -58,56 +64,43 @@ module.exports = function (grunt) {
           port: 9000,
           node_env: 'development',
           debug: true,
-          background: true
+          background: false
         }
       }
     },
-    watch: {
-      express: {
-        files: [ paths.main, paths.routes, paths.src ],
-        tasks: [ 'express:dev' ],
-        options: {
-          livereload: true,
-          spawn: false
-        }
+    sass: {
+      options: {
+        includePaths: [ 'node_modules/bootstrap-sass/assets/stylesheets/' ]
       },
       dev: {
+        files: {
+          'public/stylesheets/global.css': paths.scss
+        }
+      }
+    },
+    watch: {
+      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-browserify')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
+  // Load automatically all the tasks
+  require('load-grunt-tasks')(grunt)
 
-    grunt.task.run(
-      '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-browserify')
-    grunt.loadNpmTasks('grunt-contrib-watch')
-    grunt.loadNpmTasks('grunt-express-server')
-    grunt.loadNpmTasks('grunt-contrib-copy')
-    grunt.loadNpmTasks('grunt-newer')
-
-    grunt.task.run(
-      '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 () {