2
0
Fork 0

readme typo.

This commit is contained in:
Willem 2015-03-14 19:12:16 +01:00
parent 95478f85c3
commit 46012dc62d

View file

@ -9,7 +9,8 @@ A Node.js library providing automatic site assets aggregation.
## Example Application
There is a fully working bootstrap with angularjs example in the example folder.
There is a fully working express example application in the example folder.
This contains bootstrap and angularjs and ejs templates and results in single js and css file.
## Usage
@ -50,7 +51,7 @@ A Node.js library providing automatic site assets aggregation.
var express = require('express');
var async = require('async');
var path = require('path');
var assets = require('../lib/node-ff-assets');
var assets = require('node-ff-assets');
function buildAssets(server,callbackDone) {
var singleResult = 'false' !== process.env.DEV_ASSETS_SINGLE_RESULT;
@ -86,17 +87,6 @@ A Node.js library providing automatic site assets aggregation.
},callbackDone);
}
function renderTemplatePath(viewPath) {
return function (req, res) {
res.locals.query = req.query;
var qi = req.url.indexOf('?');
if (qi === -1) {
qi = req.url.length;
}
res.render(viewPath + req.url.substring(req.route.path.length-1, qi));
};
}
function renderPage(server) {
return function (req, res) {
res.render('index', {
@ -108,13 +98,6 @@ A Node.js library providing automatic site assets aggregation.
};
}
function sendRedirect() {
return function (req, res) {
res.redirect('/example-ui');
};
}
var server = express();
buildAssets(server,function(err) {
if (err) {
@ -122,26 +105,11 @@ A Node.js library providing automatic site assets aggregation.
}
console.info('Server assets done.');
server.set('view engine', 'ejs');
server.set('views', path.join(__dirname,'www_views'));
server.use('/static', express.static(path.join(__dirname,'www_static')));
server.use('/static/module/bootstrap', express.static(path.join(__dirname,'node_modules/bootstrap/dist')));
server.use('/static/module/flot', express.static(path.join(__dirname,'node_modules/flot')));
server.get('/example-ui',renderPage(server));
server.get('/', sendRedirect());
server.get('/example-ui/thtml/*', renderTemplatePath('thtml/'));
server.get('/example-ui', renderPage(server));
server.get('/example-ui/*', renderPage(server)); // must be last; for HTML5 history
console.info('Server config done.');
server.listen(8080);
console.info('Server started on port 8080');
...snip.. config rest of server
});
module.exports = {
version: 'example'
};
### index.ejs
<!DOCTYPE html>