diff --git a/Gruntfile.js b/Gruntfile.js index 3ee80b2..ecadc79 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,14 +16,27 @@ module.exports = function (grunt) { node: true, quotmark: 'single' } + }, + + less: { + all: { + options: { + cleancss: true + }, + files: { + 'public/css/main.css': 'public/less/main.less' + } + } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-less'); grunt.registerTask('lint', ['jshint']); - grunt.registerTask('default', ['lint']); - grunt.registerTask('ci', ['lint']); + grunt.registerTask('compile', ['less']); + grunt.registerTask('default', ['compile', 'lint']); + grunt.registerTask('ci', ['compile', 'lint']); }; \ No newline at end of file diff --git a/README.md b/README.md index 2d4b97f..a9caa31 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,12 @@ $ cp config/production.sample.json config/production.json Each of these files defines configurations for a different environment. If you're just running the application locally, then you should be OK with just development configurations. The [available configurations are documented here](#configurations). +You'll need [Grunt][grunt] to be installed globally in order to compile front-end assets. Run `npm install -g grunt-cli` to install grunt if you haven't already, then to compile assets: + +``` +$ grunt compile +``` + Now that you've got your application configured, you can run in each mode with the following commands: ```sh @@ -63,6 +69,7 @@ pa11y-dashboard is licensed under the [GNU General Public License 3.0][gpl]. [gpl]: http://www.gnu.org/licenses/gpl-3.0.html +[grunt]: http://gruntjs.com/ [node]: http://nodejs.org/ [pa11y]: https://github.com/nature/pa11y [pa11y-webservice]: https://github.com/nature/pa11y-webservice diff --git a/app.js b/app.js index 43f6b5d..71983b4 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,6 @@ var EventEmitter = require('events').EventEmitter; var express = require('express'); var hbs = require('express-hbs'); var http = require('http'); -var lessMiddleware = require('less-middleware'); var pkg = require('./package.json'); module.exports = initApp; @@ -20,12 +19,6 @@ function initApp (config, callback) { app.webservice = createClient(config.webservice); // Public files - app.express.use(lessMiddleware({ - src: __dirname + '/public/less', - dest: __dirname + '/public/css', - prefix: '/css', - yuicompress: true - })); app.express.use(express.static(__dirname + '/public', { maxAge: (process.env.NODE_ENV === 'production' ? 604800 : 0) })); diff --git a/package.json b/package.json index e6fbf16..f1a94ba 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "chalk": "~0.2", "express": "~3.4", "express-hbs": "~0.2", - "less-middleware": "~0.1", "moment": "~2.2", "pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.5", "underscore": "~1.5" @@ -34,6 +33,7 @@ "devDependencies": { "grunt": "~0.4", "grunt-contrib-jshint": "~0.7", + "grunt-contrib-less": "~0.8", "supervisor": "~0.5" },