Просмотр исходного кода

HUE-5706 [core] Use grunt watch to listen to less file changes and recompile automatically.

Run this and less -> css will be done automatically.

$> npm run watch

(cherry picked from commit eb47e19368a1b0ddac84cc9910268e0e8dc08aa3)
Andrew Yao 8 лет назад
Родитель
Сommit
e5bef4c
2 измененных файлов с 13 добавлено и 1 удалено
  1. 10 0
      Gruntfile.js
  2. 3 1
      package.json

+ 10 - 0
Gruntfile.js

@@ -3,6 +3,7 @@ module.exports = function(grunt) {
 
   var config = {};
   grunt.loadNpmTasks('grunt-contrib-less');
+  grunt.loadNpmTasks('grunt-contrib-watch');
 
   // Project configuration.
   grunt.initConfig({
@@ -17,6 +18,15 @@ module.exports = function(grunt) {
           'desktop/core/src/desktop/static/desktop/css/responsive.css': 'desktop/core/src/desktop/static/desktop/less/responsive.less'
         }
       }
+    },
+    watch: {
+      less: {
+        files: [
+          'desktop/core/src/desktop/static/desktop/less/*.less',
+          'desktop/core/src/desktop/static/desktop/less/**/*.less'
+        ],
+        tasks: ['less']
+      }
     }
   });
 };

+ 3 - 1
package.json

@@ -23,11 +23,13 @@
   "devDependencies": {
     "grunt": "0.4.5",
     "grunt-contrib-less": "1.3.0",
+    "grunt-contrib-watch": "0.6.1",
     "load-grunt-tasks": "3.1.0"
   },
   "scripts": {
     "devinstall": "npm cache clean && npm install && npm prune",
-    "less": "./node_modules/.bin/grunt less"
+    "less": "./node_modules/.bin/grunt less",
+    "watch": "./node_modules/.bin/grunt watch"
   },
   "files": []
 }