forked from external-repos/pa11y-dashboard
Compile LESS files with grunt
This commit is contained in:
17
Gruntfile.js
17
Gruntfile.js
@@ -16,14 +16,27 @@ module.exports = function (grunt) {
|
|||||||
node: true,
|
node: true,
|
||||||
quotmark: 'single'
|
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-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
|
|
||||||
grunt.registerTask('lint', ['jshint']);
|
grunt.registerTask('lint', ['jshint']);
|
||||||
grunt.registerTask('default', ['lint']);
|
grunt.registerTask('compile', ['less']);
|
||||||
grunt.registerTask('ci', ['lint']);
|
grunt.registerTask('default', ['compile', 'lint']);
|
||||||
|
grunt.registerTask('ci', ['compile', 'lint']);
|
||||||
|
|
||||||
};
|
};
|
@@ -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).
|
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:
|
Now that you've got your application configured, you can run in each mode with the following commands:
|
||||||
|
|
||||||
```sh
|
```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
|
[gpl]: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
[grunt]: http://gruntjs.com/
|
||||||
[node]: http://nodejs.org/
|
[node]: http://nodejs.org/
|
||||||
[pa11y]: https://github.com/nature/pa11y
|
[pa11y]: https://github.com/nature/pa11y
|
||||||
[pa11y-webservice]: https://github.com/nature/pa11y-webservice
|
[pa11y-webservice]: https://github.com/nature/pa11y-webservice
|
||||||
|
7
app.js
7
app.js
@@ -5,7 +5,6 @@ var EventEmitter = require('events').EventEmitter;
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var hbs = require('express-hbs');
|
var hbs = require('express-hbs');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var lessMiddleware = require('less-middleware');
|
|
||||||
var pkg = require('./package.json');
|
var pkg = require('./package.json');
|
||||||
|
|
||||||
module.exports = initApp;
|
module.exports = initApp;
|
||||||
@@ -20,12 +19,6 @@ function initApp (config, callback) {
|
|||||||
app.webservice = createClient(config.webservice);
|
app.webservice = createClient(config.webservice);
|
||||||
|
|
||||||
// Public files
|
// 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', {
|
app.express.use(express.static(__dirname + '/public', {
|
||||||
maxAge: (process.env.NODE_ENV === 'production' ? 604800 : 0)
|
maxAge: (process.env.NODE_ENV === 'production' ? 604800 : 0)
|
||||||
}));
|
}));
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
"chalk": "~0.2",
|
"chalk": "~0.2",
|
||||||
"express": "~3.4",
|
"express": "~3.4",
|
||||||
"express-hbs": "~0.2",
|
"express-hbs": "~0.2",
|
||||||
"less-middleware": "~0.1",
|
|
||||||
"moment": "~2.2",
|
"moment": "~2.2",
|
||||||
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.5",
|
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.5",
|
||||||
"underscore": "~1.5"
|
"underscore": "~1.5"
|
||||||
@@ -34,6 +33,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4",
|
"grunt": "~0.4",
|
||||||
"grunt-contrib-jshint": "~0.7",
|
"grunt-contrib-jshint": "~0.7",
|
||||||
|
"grunt-contrib-less": "~0.8",
|
||||||
"supervisor": "~0.5"
|
"supervisor": "~0.5"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user