boxwood 0.77.0 → 0.77.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/README.md +10 -5
- package/index.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,6 +48,8 @@ const html = template({ foo: "bar" })
|
|
|
48
48
|
console.log(html)
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
You can use [express-boxwood](https://www.npmjs.com/package/express-boxwood) for [express](https://www.npmjs.com/package/express).
|
|
52
|
+
|
|
51
53
|
## Syntax
|
|
52
54
|
|
|
53
55
|
```js
|
|
@@ -67,17 +69,20 @@ module.exports = () => {
|
|
|
67
69
|
|
|
68
70
|
```js
|
|
69
71
|
// example/layout/index.js
|
|
70
|
-
const { component, css, html, body } = require("boxwood")
|
|
72
|
+
const { component, css, doctype, html, body } = require("boxwood")
|
|
71
73
|
const head = require("./head")
|
|
72
74
|
|
|
73
75
|
const styles = css.load(__dirname)
|
|
74
76
|
|
|
75
77
|
module.exports = component(
|
|
76
78
|
({ language }, children) => {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
return [
|
|
80
|
+
doctype(),
|
|
81
|
+
html({ lang: language }, [
|
|
82
|
+
head(),
|
|
83
|
+
body({ className: styles.layout }, children),
|
|
84
|
+
]),
|
|
85
|
+
]
|
|
81
86
|
},
|
|
82
87
|
{ styles }
|
|
83
88
|
)
|
package/index.js
CHANGED
|
@@ -29,6 +29,9 @@ async function compile(path) {
|
|
|
29
29
|
node.ignore = true
|
|
30
30
|
}
|
|
31
31
|
if (node.name === "script") {
|
|
32
|
+
if (node.attributes && node.attributes.src) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
32
35
|
const js = node.children
|
|
33
36
|
if (
|
|
34
37
|
node.attributes &&
|
|
@@ -135,7 +138,12 @@ const attributes = (options) => {
|
|
|
135
138
|
const result = []
|
|
136
139
|
for (const key in options) {
|
|
137
140
|
const value = options[key]
|
|
138
|
-
if (
|
|
141
|
+
if (
|
|
142
|
+
typeof value === "string" ||
|
|
143
|
+
typeof value === "number" ||
|
|
144
|
+
value === true ||
|
|
145
|
+
Array.isArray(value)
|
|
146
|
+
) {
|
|
139
147
|
if (BOOLEAN_ATTRIBUTES.includes(key)) {
|
|
140
148
|
result.push(key)
|
|
141
149
|
} else {
|