diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-27 00:18:34 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-27 00:18:34 +0000 |
| commit | 25706820837bd05cdc3b186eb1d5ebabf9688a61 (patch) | |
| tree | afbc83b902d3f0789d5174bd2e2798937ab57b26 /node_modules/express-minify-html/examples/handlebars/handlebars-example.js | |
| parent | 38594fd274a4bebee75ae71dbed457b39d253cae (diff) | |
| parent | 714368c049f8749ed22c6d1d07bb3adc783dc349 (diff) | |
Merge branch 'master' of https://github.com/HumairAK/solutions_repo
Diffstat (limited to 'node_modules/express-minify-html/examples/handlebars/handlebars-example.js')
| -rw-r--r-- | node_modules/express-minify-html/examples/handlebars/handlebars-example.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/node_modules/express-minify-html/examples/handlebars/handlebars-example.js b/node_modules/express-minify-html/examples/handlebars/handlebars-example.js new file mode 100644 index 0000000..eb39a06 --- /dev/null +++ b/node_modules/express-minify-html/examples/handlebars/handlebars-example.js @@ -0,0 +1,39 @@ +'use strict'; + +var express = require('express'); +var minifyHTML = require('../../minifier.js'); +var exhbs = require('express-handlebars'); + +var app = express(); + +var hbs = exhbs.create({ + defaultLayout: 'main', + layoutsDir: './' +}); + +app.engine('handlebars', hbs.engine); +app.set('view engine', 'handlebars'); +app.set('views', './'); + +app.use(minifyHTML({ + override: true, + htmlMinifier: { + removeComments: true, + collapseWhitespace: true, + collapseBooleanAttributes: true, + removeAttributeQuotes: true, + removeEmptyAttributes: true, + minifyJS: true + } +})); + +app.get('/', function(req, res) { + res.render('main', { hello: 'world' }); +}); + +var server = app.listen(3000, function() { + var host = server.address().address; + var port = server.address().port; + + console.log('Handlebars example app listening at http://%s:%s', host, port); +}); |
