From 04c5d5d78cd83ecdd792c69691f7d300a2c5aca2 Mon Sep 17 00:00:00 2001 From: Luke Page Date: Thu, 5 Sep 2013 12:28:26 +0100 Subject: [PATCH] re-organise the grunt tasks a little and update readme --- Gruntfile.js | 43 ++++++++++++++++++++++++++++--------------- README.md | 35 ++++++++++++++++++++--------------- build/README.md | 33 +++++++++++++++++++-------------- 3 files changed, 67 insertions(+), 44 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 72a60059..898b84d0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,7 +43,7 @@ module.exports = function(grunt) { footer: '\n})(window);' }, // Browser versions - browser: { + browsertest: { src: ['<%= build.browser %>'], dest: 'test/browser/less.js' }, @@ -55,6 +55,10 @@ module.exports = function(grunt) { src: ['<%= build.browser %>'], dest: 'dist/less-<%= pkg.version %>-beta.js' }, + stable: { + src: ['<%= build.browser %>'], + dest: 'dist/less-<%= pkg.version %>.js' + }, // Rhino rhino: { options: { @@ -78,10 +82,6 @@ module.exports = function(grunt) { banner: '<%= meta.banner %>', mangle: true }, - browser: { - src: ['<%= concat.browser.src %>'], - dest: 'dist/less-<%= pkg.version %>.min.js' - }, alpha: { src: ['<%= concat.alpha.src %>'], dest: 'dist/less-<%= pkg.version %>-alpha.min.js' @@ -89,6 +89,10 @@ module.exports = function(grunt) { beta: { src: ['<%= concat.beta.src %>'], dest: 'dist/less-<%= pkg.version %>-beta.min.js' + }, + stable: { + src: ['<%= concat.browser.src %>'], + dest: 'dist/less-<%= pkg.version %>.min.js' } }, @@ -202,11 +206,9 @@ module.exports = function(grunt) { } }, - // Before running tests, clean out the results - // of any previous tests. (this will need to be - // setup based on configuration of browser tests). + // Clean the version of less built for the tests clean: { - test: ['test/browser/test-runner-*.htm'] + test: ['test/browser/less.js'] } }); @@ -216,10 +218,9 @@ module.exports = function(grunt) { // Actually load this plugin's task(s). grunt.loadTasks('build/tasks'); - // Default task to build Less.js + // by default, run tests grunt.registerTask('default', [ - 'concat:browser', - 'uglify:browser' + 'test' ]); // Alpha @@ -234,18 +235,30 @@ module.exports = function(grunt) { 'uglify:beta' ]); - // Run all tests - grunt.registerTask('browser', [ + // Beta + grunt.registerTask('stable', [ + 'concat:stable', + 'uglify:stable' + ]); + + // Run all browser tests + grunt.registerTask('browsertest', [ 'connect', 'jasmine' ]); + // Create the browser version of less.js + grunt.registerTask('browser', [ + 'concat:browsertest' + ]); + // Run all tests grunt.registerTask('test', [ 'clean', 'jshint', 'shell:test', - 'browser' + 'browser', + 'browsertest' ]); // Run benchmark diff --git a/README.md b/README.md index 6783ffc6..e8f11cff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [Less.js v1.4.2](http://lesscss.org) +# [Less.js v1.5.0-b1](http://lesscss.org) > The **dynamic** stylesheet language. [http://lesscss.org](http://lesscss.org). @@ -280,33 +280,38 @@ and then `cd less`. #### Install dependencies -Tests and benchmarking require Grunt `~0.4.1`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to install and use Grunt plugins, which are necessary for development with Less.js. - -To install Grunt and other necessary dependencies run: +To install all the dependencies for less development, run: ```shell npm install ``` -You should now be able to build Less.js, run tests, benchmarking, and other tasks listed in the Gruntfile. - - -## Building Less.js - -The Less.js [Gruntfile](Gruntfile.js) is configured with the following "convenience tasks" (you must first install [the necessary local dependencies](package.json)): +If you haven't run grunt before, install grunt-cli globally so you can just run `grunt` ```shell -$ npm install +npm install grunt-cli -g ``` -When all of the necessary dependencies are installed you may run the various Grunt.js commands provided: +You should now be able to build Less.js, run tests, benchmarking, and other tasks listed in the Gruntfile. -#### build - `grunt` -Build Less.js from from the `/lib/less` source files. +## Using Less.js Grunt -#### test - `grunt test` +Tests, benchmarking and building is done using Grunt `~0.4.1`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to install and use Grunt plugins, which are necessary for development with Less.js. + +The Less.js [Gruntfile](Gruntfile.js) is configured with the following "convenience tasks" : + +#### test - `grunt` Runs jshint, nodeunit and headless jasmine tests using [phantomjs](http://code.google.com/p/phantomjs/). You must have phantomjs installed for the jasmine tests to run. +#### test - `grunt benchmark` +Runs the benchmark suite. + +#### build for testing browser - 'grunt browser' +This builds less.js and puts it in 'test/browser/less.js' + +#### build - `grunt stable | grunt beta | grunt alpha` +Builds Less.js from from the `/lib/less` source files. This is done by the developer releasing a new release, do not do this if you are creating a pull request. + #### readme - `grunt readme` Build the README file from [a template](build/README.md) to ensure that metadata is up-to-date and (more likely to be) correct. diff --git a/build/README.md b/build/README.md index e3d4e49c..f2d5359a 100644 --- a/build/README.md +++ b/build/README.md @@ -280,33 +280,38 @@ and then `cd less`. #### Install dependencies -Tests and benchmarking require Grunt `<%= pkg.devDependencies.grunt %>`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to install and use Grunt plugins, which are necessary for development with Less.js. - -To install Grunt and other necessary dependencies run: +To install all the dependencies for less development, run: ```shell npm install ``` -You should now be able to build Less.js, run tests, benchmarking, and other tasks listed in the Gruntfile. - - -## Building Less.js - -The Less.js [Gruntfile](Gruntfile.js) is configured with the following "convenience tasks" (you must first install [the necessary local dependencies](package.json)): +If you haven't run grunt before, install grunt-cli globally so you can just run `grunt` ```shell -$ npm install +npm install grunt-cli -g ``` -When all of the necessary dependencies are installed you may run the various Grunt.js commands provided: +You should now be able to build Less.js, run tests, benchmarking, and other tasks listed in the Gruntfile. -#### build - `grunt` -Build Less.js from from the `/lib/less` source files. +## Using Less.js Grunt -#### test - `grunt test` +Tests, benchmarking and building is done using Grunt `<%= pkg.devDependencies.grunt %>`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to install and use Grunt plugins, which are necessary for development with Less.js. + +The Less.js [Gruntfile](Gruntfile.js) is configured with the following "convenience tasks" : + +#### test - `grunt` Runs jshint, nodeunit and headless jasmine tests using [phantomjs](http://code.google.com/p/phantomjs/). You must have phantomjs installed for the jasmine tests to run. +#### test - `grunt benchmark` +Runs the benchmark suite. + +#### build for testing browser - 'grunt browser' +This builds less.js and puts it in 'test/browser/less.js' + +#### build - `grunt stable | grunt beta | grunt alpha` +Builds Less.js from from the `/lib/less` source files. This is done by the developer releasing a new release, do not do this if you are creating a pull request. + #### readme - `grunt readme` Build the README file from [a template](build/README.md) to ensure that metadata is up-to-date and (more likely to be) correct.