boxwood 0.61.1 → 0.61.2

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.
Files changed (2) hide show
  1. package/index.js +5 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -9,7 +9,7 @@ async function compile(path) {
9
9
  const nodes = {}
10
10
  const styles = []
11
11
  const scripts = []
12
- const find = (node) => {
12
+ const walk = (node) => {
13
13
  if (node.name === 'head') {
14
14
  nodes.head = node
15
15
  }
@@ -22,10 +22,12 @@ async function compile(path) {
22
22
  node.ignore = true
23
23
  }
24
24
  if (Array.isArray(node)) {
25
- node.forEach(find)
25
+ node.forEach(walk)
26
+ } else if (Array.isArray(node.children)) {
27
+ node.children.forEach(walk)
26
28
  }
27
29
  }
28
- walk(tree, find)
30
+ walk(tree)
29
31
  if (nodes.head) {
30
32
  if (styles.length > 0) {
31
33
  nodes.head.children.push({
@@ -45,13 +47,6 @@ async function compile(path) {
45
47
  }
46
48
  }
47
49
 
48
- function walk(tree, callback) {
49
- callback(tree)
50
- if (Array.isArray(tree.children)) {
51
- tree.children.map((node) => walk(node, callback))
52
- }
53
- }
54
-
55
50
  const ENTITIES = {
56
51
  '&': '&',
57
52
  '<': '&lt;',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boxwood",
3
- "version": "0.61.1",
3
+ "version": "0.61.2",
4
4
  "description": "Compile HTML templates into JS",
5
5
  "main": "index.js",
6
6
  "scripts": {