From 37940f3974f8f6a074998c32d6d2fee9d7625842 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 24 Feb 2014 15:47:09 -0700 Subject: [PATCH] added less compilation via watch, and a task which will build the less and jade, start the server, then watch for changes --- package.json | 3 ++- src/kibana/apps/examples/styles/index.less | 2 +- src/kibana/styles/main.less | 6 +++--- tasks/config/less.js | 13 +++++++++++++ tasks/config/watch.js | 6 +++++- tasks/default.js | 4 ++-- tasks/dev.js | 3 +++ 7 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 tasks/config/less.js create mode 100644 tasks/dev.js diff --git a/package.json b/package.json index 0bcd8e06542f..ffe5760579f9 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "mocha": "~1.17.1", "less-middleware": "~0.1.15", "grunt-contrib-watch": "~0.5.3", - "grunt-contrib-jade": "~0.10.0" + "grunt-contrib-jade": "~0.10.0", + "grunt-contrib-less": "~0.9.0" }, "scripts": { "test": "grunt test", diff --git a/src/kibana/apps/examples/styles/index.less b/src/kibana/apps/examples/styles/index.less index a4519487abb4..7550f31b1edb 100644 --- a/src/kibana/apps/examples/styles/index.less +++ b/src/kibana/apps/examples/styles/index.less @@ -1,4 +1,4 @@ #examples ng-include { display: block; margin: 10px; -} \ No newline at end of file +} diff --git a/src/kibana/styles/main.less b/src/kibana/styles/main.less index 7c7836f7089b..2fb66c971462 100644 --- a/src/kibana/styles/main.less +++ b/src/kibana/styles/main.less @@ -1,6 +1,6 @@ -@import '../../bower_components/bootstrap/less/bootstrap.less'; -@import '../../bower_components/bootstrap/less/theme.less'; +@import "../../bower_components/bootstrap/less/bootstrap.less"; +@import "../../bower_components/bootstrap/less/theme.less"; body { margin: 25px; -} \ No newline at end of file +} diff --git a/tasks/config/less.js b/tasks/config/less.js new file mode 100644 index 000000000000..058206fb5938 --- /dev/null +++ b/tasks/config/less.js @@ -0,0 +1,13 @@ +module.exports = { + src: { + src: [ + '<%= app %>/styles/**/*.less', + '<%= app %>/apps/**/*.less' + ], + expand: true, + ext: '.css', + options: { + ieCompat: false + } + } +}; \ No newline at end of file diff --git a/tasks/config/watch.js b/tasks/config/watch.js index 130171e123b1..d1aaded99bde 100644 --- a/tasks/config/watch.js +++ b/tasks/config/watch.js @@ -3,6 +3,10 @@ module.exports = function (grunt) { test: { files: ['<%= unitTestDir %>/*.jade', '<%= unitTestDir %>/**/*.js'], tasks: ['jade:test', 'mocha:unit'] + }, + src: { + files: ['<%= src %>'], + tasks: ['less'] } - } + }; }; diff --git a/tasks/default.js b/tasks/default.js index 0c84401dc93c..e82b711d23b9 100644 --- a/tasks/default.js +++ b/tasks/default.js @@ -1,4 +1,4 @@ // Lint and build CSS -module.exports = function(grunt) { - grunt.registerTask('default', ['jshint:source','test']); +module.exports = function (grunt) { + grunt.registerTask('default', ['jshint:source', 'test']); }; \ No newline at end of file diff --git a/tasks/dev.js b/tasks/dev.js new file mode 100644 index 000000000000..ee4c78feec73 --- /dev/null +++ b/tasks/dev.js @@ -0,0 +1,3 @@ +module.exports = function (grunt) { + grunt.registerTask('dev', ['less', 'jade', 'connect:dev', 'watch']); +}; \ No newline at end of file