aboutsummaryrefslogtreecommitdiff
path: root/node_modules/express-minify-html/examples/handlebars
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 00:03:35 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 00:03:35 +0000
commit8beb37ed67b5f2fa0f9aa85499a8f11b39c9d067 (patch)
treebd4b05a1e374b6cb10097bbcfbc12ef51c1cb85b /node_modules/express-minify-html/examples/handlebars
parent5e73fe37c32faf821d3d16f0251007e366cb090b (diff)
need pull
Diffstat (limited to 'node_modules/express-minify-html/examples/handlebars')
-rw-r--r--node_modules/express-minify-html/examples/handlebars/handlebars-example.js39
-rw-r--r--node_modules/express-minify-html/examples/handlebars/main.handlebars20
-rw-r--r--node_modules/express-minify-html/examples/handlebars/package.json16
3 files changed, 75 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);
+});
diff --git a/node_modules/express-minify-html/examples/handlebars/main.handlebars b/node_modules/express-minify-html/examples/handlebars/main.handlebars
new file mode 100644
index 0000000..f46809e
--- /dev/null
+++ b/node_modules/express-minify-html/examples/handlebars/main.handlebars
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<!-- This unnecessary HTML comment should probably be removed! -->
+ <head class="head">
+ <meta charset="UTF-8">
+ <title>Express minify HTML handlebars example</title>
+ </head>
+ <body id="body">
+ Hello {{hello}}!
+ </body>
+ <script type="text/javascript">
+ function reallyNiceFunction () {
+
+
+ return "Hello!";
+
+
+ };
+ </script>
+</html> \ No newline at end of file
diff --git a/node_modules/express-minify-html/examples/handlebars/package.json b/node_modules/express-minify-html/examples/handlebars/package.json
new file mode 100644
index 0000000..9b6dc5e
--- /dev/null
+++ b/node_modules/express-minify-html/examples/handlebars/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "express-minify-html-handlebars-example",
+ "version": "0.0.1",
+ "description": "Handlebars.js example for this middleware",
+ "main": "handlebars-example.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "start": "node handlebars-example.js"
+ },
+ "author": "Matti Jokitulppo <melonmnchan@gmail.com>",
+ "license": "MIT",
+ "dependencies": {
+ "express": "^4.13.3",
+ "express-handlebars": "^2.0.1"
+ }
+}