boxwood 0.59.0 → 0.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boxwood",
3
- "version": "0.59.0",
3
+ "version": "0.59.1",
4
4
  "description": "Compile HTML templates into JS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,5 @@
1
+ function optimize (html) {
2
+ return html.trim()
3
+ }
4
+
5
+ module.exports = { optimize }
package/src/render.js CHANGED
@@ -4,6 +4,7 @@ const { readFile } = require('fs')
4
4
  const { dirname } = require('path')
5
5
  const { promisify } = require('util')
6
6
  const { print } = require('./utilities/log')
7
+ const { optimize } = require('./optimizers/html')
7
8
 
8
9
  const read = promisify(readFile)
9
10
 
@@ -32,8 +33,9 @@ function createRender ({
32
33
  const template = await compileFile(path)
33
34
  const params = typeof globals === 'function' ? globals(path, options) : globals
34
35
  const html = template({ ...params, ...options }, escape)
35
- if (callback) return callback(null, html)
36
- return html
36
+ const optimizedHtml = optimize(html)
37
+ if (callback) return callback(null, optimizedHtml)
38
+ return optimizedHtml
37
39
  } catch (exception) {
38
40
  if (callback) return callback(exception)
39
41
  return exception.message