@maizzle/framework 4.0.0-alpha.9 → 4.0.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.
- package/.editorconfig +9 -9
- package/.github/media/logo-dark.svg +1 -0
- package/.github/media/logo-light.svg +1 -0
- package/.github/workflows/nodejs.yml +28 -28
- package/LICENSE +21 -21
- package/README.md +42 -35
- package/bin/maizzle +3 -3
- package/package.json +91 -91
- package/src/generators/config.js +32 -32
- package/src/generators/output/index.js +4 -4
- package/src/generators/output/to-disk.js +208 -208
- package/src/generators/output/to-string.js +1 -5
- package/src/generators/postcss.js +29 -29
- package/src/generators/posthtml.js +66 -66
- package/src/index.js +17 -17
- package/src/transformers/attributeToStyle.js +90 -90
- package/src/transformers/baseUrl.js +69 -69
- package/src/transformers/extraAttributes.js +26 -26
- package/src/transformers/filters/defaultFilters.js +126 -126
- package/src/transformers/filters/index.js +55 -55
- package/src/transformers/index.js +63 -60
- package/src/transformers/inlineCss.js +37 -50
- package/src/transformers/markdown.js +19 -19
- package/src/transformers/minify.js +21 -21
- package/src/transformers/plaintext.js +23 -23
- package/src/transformers/posthtmlMso.js +10 -10
- package/src/transformers/prettify.js +9 -11
- package/src/transformers/preventWidows.js +13 -13
- package/src/transformers/removeAttributes.js +17 -17
- package/src/transformers/removeInlineBackgroundColor.js +52 -52
- package/src/transformers/removeInlineSizes.js +41 -41
- package/src/transformers/replaceStrings.js +14 -14
- package/src/transformers/safeClassNames.js +24 -24
- package/src/transformers/shorthandInlineCSS.js +19 -0
- package/src/transformers/sixHex.js +33 -33
- package/src/transformers/urlParameters.js +17 -17
- package/src/utils/helpers.js +17 -17
- package/test/expected/posthtml/component.html +1 -1
- package/test/expected/posthtml/extend-template.html +2 -2
- package/test/expected/posthtml/fetch.html +5 -5
- package/test/expected/posthtml/layout.html +3 -3
- package/test/expected/transformers/atimport-in-style.html +12 -13
- package/test/expected/transformers/base-url.html +99 -99
- package/test/expected/transformers/preserve-transform-css.html +33 -45
- package/test/expected/useConfig.html +6 -6
- package/test/fixtures/posthtml/component.html +2 -2
- package/test/fixtures/posthtml/extend-template.html +7 -7
- package/test/fixtures/posthtml/fetch.html +9 -9
- package/test/fixtures/posthtml/layout.html +11 -11
- package/test/fixtures/transformers/base-url.html +101 -101
- package/test/stubs/assets/foo.bar +1 -1
- package/test/stubs/breaking/bad.html +5 -5
- package/test/stubs/config/config.js +10 -10
- package/test/stubs/config/config.maizzle-ci.js +10 -10
- package/test/stubs/data.json +14 -14
- package/test/stubs/events/before-create.html +1 -1
- package/test/stubs/layouts/basic.html +1 -1
- package/test/stubs/layouts/full.html +12 -12
- package/test/stubs/layouts/template.html +5 -5
- package/test/stubs/main.css +5 -5
- package/test/stubs/tailwind/content-source.html +1 -1
- package/test/stubs/tailwind/tailwind.css +3 -3
- package/test/stubs/template.html +10 -10
- package/test/test-config.js +19 -19
- package/test/test-postcss.js +8 -8
- package/test/test-posthtml.js +17 -11
- package/test/test-tailwindcss.js +117 -117
- package/test/test-todisk.js +1 -1
- package/test/test-transformers.js +511 -490
- package/xo.config.js +22 -22
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
const posthtml = require('posthtml')
|
|
2
|
-
const {get, isEmpty} = require('lodash')
|
|
3
|
-
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
-
|
|
5
|
-
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
7
|
-
|
|
8
|
-
if (isEmpty(config)) {
|
|
9
|
-
return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (get(config, 'inlineCSS.preferBgColorAttribute') === true) {
|
|
13
|
-
return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const tags = direct ? (Array.isArray(config) ? config : false) : get(config, 'inlineCSS.preferBgColorAttribute', false)
|
|
17
|
-
|
|
18
|
-
if (Array.isArray(tags)) {
|
|
19
|
-
return posthtml([removeInlineBGColor({tags})]).process(html, posthtmlOptions).then(result => result.html)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return html
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const removeInlineBGColor = (options = {}) => tree => {
|
|
26
|
-
options.tags = options.tags || ['body', 'marquee', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr']
|
|
27
|
-
|
|
28
|
-
const process = node => {
|
|
29
|
-
if (!options.tags.includes(node.tag)) {
|
|
30
|
-
return node
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const attrs = parseAttrs(node.attrs, {
|
|
34
|
-
rules: {
|
|
35
|
-
bgcolor: {
|
|
36
|
-
delimiter: /\s+/,
|
|
37
|
-
glue: ' '
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
if (attrs.style && attrs.style['background-color']) {
|
|
43
|
-
attrs.bgcolor = attrs.style['background-color']
|
|
44
|
-
delete attrs.style['background-color']
|
|
45
|
-
node.attrs = attrs.compose()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return node
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return tree.walk(process)
|
|
52
|
-
}
|
|
1
|
+
const posthtml = require('posthtml')
|
|
2
|
+
const {get, isEmpty} = require('lodash')
|
|
3
|
+
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
+
|
|
5
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
7
|
+
|
|
8
|
+
if (isEmpty(config)) {
|
|
9
|
+
return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (get(config, 'inlineCSS.preferBgColorAttribute') === true) {
|
|
13
|
+
return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const tags = direct ? (Array.isArray(config) ? config : false) : get(config, 'inlineCSS.preferBgColorAttribute', false)
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(tags)) {
|
|
19
|
+
return posthtml([removeInlineBGColor({tags})]).process(html, posthtmlOptions).then(result => result.html)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return html
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const removeInlineBGColor = (options = {}) => tree => {
|
|
26
|
+
options.tags = options.tags || ['body', 'marquee', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr']
|
|
27
|
+
|
|
28
|
+
const process = node => {
|
|
29
|
+
if (!options.tags.includes(node.tag)) {
|
|
30
|
+
return node
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const attrs = parseAttrs(node.attrs, {
|
|
34
|
+
rules: {
|
|
35
|
+
bgcolor: {
|
|
36
|
+
delimiter: /\s+/,
|
|
37
|
+
glue: ' '
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
if (attrs.style && attrs.style['background-color']) {
|
|
43
|
+
attrs.bgcolor = attrs.style['background-color']
|
|
44
|
+
delete attrs.style['background-color']
|
|
45
|
+
node.attrs = attrs.compose()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return node
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return tree.walk(process)
|
|
52
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
const posthtml = require('posthtml')
|
|
2
|
-
const {get, isEmpty} = require('lodash')
|
|
3
|
-
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
-
|
|
5
|
-
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
-
const settings = direct ? config : get(config, 'inlineCSS.keepOnlyAttributeSizes', {})
|
|
7
|
-
|
|
8
|
-
if (!isEmpty(settings)) {
|
|
9
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
10
|
-
return posthtml([removeInlineSizes(settings)]).process(html, posthtmlOptions).then(result => result.html)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return html
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const removeInlineSizes = (mappings = {}) => tree => {
|
|
17
|
-
const process = node => {
|
|
18
|
-
const attrs = parseAttrs(node.attrs)
|
|
19
|
-
const tag = node.tag ? node.tag.toUpperCase() : ''
|
|
20
|
-
|
|
21
|
-
Object.entries(mappings).forEach(([attribute, tags]) => {
|
|
22
|
-
tags = Object.values(tags)
|
|
23
|
-
|
|
24
|
-
if (!tags.includes(tag)) {
|
|
25
|
-
return node
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
tags.forEach(() => {
|
|
29
|
-
if (attrs.style) {
|
|
30
|
-
delete attrs.style[attribute]
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
node.attrs = attrs.compose()
|
|
36
|
-
|
|
37
|
-
return node
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return tree.walk(process)
|
|
41
|
-
}
|
|
1
|
+
const posthtml = require('posthtml')
|
|
2
|
+
const {get, isEmpty} = require('lodash')
|
|
3
|
+
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
+
|
|
5
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
+
const settings = direct ? config : get(config, 'inlineCSS.keepOnlyAttributeSizes', {})
|
|
7
|
+
|
|
8
|
+
if (!isEmpty(settings)) {
|
|
9
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
10
|
+
return posthtml([removeInlineSizes(settings)]).process(html, posthtmlOptions).then(result => result.html)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return html
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const removeInlineSizes = (mappings = {}) => tree => {
|
|
17
|
+
const process = node => {
|
|
18
|
+
const attrs = parseAttrs(node.attrs)
|
|
19
|
+
const tag = node.tag ? node.tag.toUpperCase() : ''
|
|
20
|
+
|
|
21
|
+
Object.entries(mappings).forEach(([attribute, tags]) => {
|
|
22
|
+
tags = Object.values(tags)
|
|
23
|
+
|
|
24
|
+
if (!tags.includes(tag)) {
|
|
25
|
+
return node
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
tags.forEach(() => {
|
|
29
|
+
if (attrs.style) {
|
|
30
|
+
delete attrs.style[attribute]
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
node.attrs = attrs.compose()
|
|
36
|
+
|
|
37
|
+
return node
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return tree.walk(process)
|
|
41
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const {isEmpty, get} = require('lodash')
|
|
2
|
-
|
|
3
|
-
module.exports = async (html, config = {}, direct = false) => {
|
|
4
|
-
const replacements = direct ? config : get(config, 'replaceStrings', {})
|
|
5
|
-
|
|
6
|
-
if (!isEmpty(replacements)) {
|
|
7
|
-
Object.entries(replacements).forEach(([k, v]) => {
|
|
8
|
-
const regex = new RegExp(k, 'gi')
|
|
9
|
-
html = html.replace(regex, v)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return html
|
|
14
|
-
}
|
|
1
|
+
const {isEmpty, get} = require('lodash')
|
|
2
|
+
|
|
3
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
4
|
+
const replacements = direct ? config : get(config, 'replaceStrings', {})
|
|
5
|
+
|
|
6
|
+
if (!isEmpty(replacements)) {
|
|
7
|
+
Object.entries(replacements).forEach(([k, v]) => {
|
|
8
|
+
const regex = new RegExp(k, 'gi')
|
|
9
|
+
html = html.replace(regex, v)
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return html
|
|
14
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const {get} = require('lodash')
|
|
2
|
-
const posthtml = require('posthtml')
|
|
3
|
-
const safeClassNames = require('posthtml-safe-class-names')
|
|
4
|
-
|
|
5
|
-
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
-
const option = get(config, 'safeClassNames')
|
|
7
|
-
|
|
8
|
-
if (option === false) {
|
|
9
|
-
return html
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Setting it to `true` in the config will run `safeClassNames`
|
|
14
|
-
* no matter the environment.
|
|
15
|
-
*/
|
|
16
|
-
if (config.env === 'local' && !option) {
|
|
17
|
-
return html
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
21
|
-
const replacements = direct ? config : get(config, 'safeClassNames', {})
|
|
22
|
-
|
|
23
|
-
return posthtml([safeClassNames({replacements})]).process(html, posthtmlOptions).then(result => result.html)
|
|
24
|
-
}
|
|
1
|
+
const {get} = require('lodash')
|
|
2
|
+
const posthtml = require('posthtml')
|
|
3
|
+
const safeClassNames = require('posthtml-safe-class-names')
|
|
4
|
+
|
|
5
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
+
const option = get(config, 'safeClassNames')
|
|
7
|
+
|
|
8
|
+
if (option === false) {
|
|
9
|
+
return html
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Setting it to `true` in the config will run `safeClassNames`
|
|
14
|
+
* no matter the environment.
|
|
15
|
+
*/
|
|
16
|
+
if (config.env === 'local' && !option) {
|
|
17
|
+
return html
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
21
|
+
const replacements = direct ? config : get(config, 'safeClassNames', {})
|
|
22
|
+
|
|
23
|
+
return posthtml([safeClassNames({replacements})]).process(html, posthtmlOptions).then(result => result.html)
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const posthtml = require('posthtml')
|
|
2
|
+
const {get, isObject, isEmpty} = require('lodash')
|
|
3
|
+
const mergeLonghand = require('posthtml-postcss-merge-longhand')
|
|
4
|
+
|
|
5
|
+
module.exports = async (html, config, direct = false) => {
|
|
6
|
+
config = direct ? (isObject(config) ? config : true) : get(config, 'shorthandInlineCSS', [])
|
|
7
|
+
|
|
8
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
9
|
+
|
|
10
|
+
if (typeof config === 'boolean' && config) {
|
|
11
|
+
html = await posthtml([mergeLonghand()]).process(html, posthtmlOptions).then(result => result.html)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (isObject(config) && !isEmpty(config)) {
|
|
15
|
+
html = await posthtml([mergeLonghand(config)]).process(html, posthtmlOptions).then(result => result.html)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return html
|
|
19
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
const {get} = require('lodash')
|
|
2
|
-
const posthtml = require('posthtml')
|
|
3
|
-
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
-
const {conv} = require('color-shorthand-hex-to-six-digit')
|
|
5
|
-
|
|
6
|
-
module.exports = async (html, config = {}) => {
|
|
7
|
-
if (get(config, 'sixHex') === false) {
|
|
8
|
-
return html
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
12
|
-
return posthtml([sixHex()]).process(html, posthtmlOptions).then(result => result.html)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const sixHex = () => tree => {
|
|
16
|
-
const process = node => {
|
|
17
|
-
const attrs = parseAttrs(node.attrs)
|
|
18
|
-
|
|
19
|
-
const targets = ['bgcolor', 'color']
|
|
20
|
-
|
|
21
|
-
targets.forEach(attribute => {
|
|
22
|
-
if (attrs[attribute]) {
|
|
23
|
-
attrs[attribute] = conv(attrs[attribute])
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
node.attrs = attrs.compose()
|
|
28
|
-
|
|
29
|
-
return node
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tree.walk(process)
|
|
33
|
-
}
|
|
1
|
+
const {get} = require('lodash')
|
|
2
|
+
const posthtml = require('posthtml')
|
|
3
|
+
const parseAttrs = require('posthtml-attrs-parser')
|
|
4
|
+
const {conv} = require('color-shorthand-hex-to-six-digit')
|
|
5
|
+
|
|
6
|
+
module.exports = async (html, config = {}) => {
|
|
7
|
+
if (get(config, 'sixHex') === false) {
|
|
8
|
+
return html
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
12
|
+
return posthtml([sixHex()]).process(html, posthtmlOptions).then(result => result.html)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const sixHex = () => tree => {
|
|
16
|
+
const process = node => {
|
|
17
|
+
const attrs = parseAttrs(node.attrs)
|
|
18
|
+
|
|
19
|
+
const targets = ['bgcolor', 'color']
|
|
20
|
+
|
|
21
|
+
targets.forEach(attribute => {
|
|
22
|
+
if (attrs[attribute]) {
|
|
23
|
+
attrs[attribute] = conv(attrs[attribute])
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
node.attrs = attrs.compose()
|
|
28
|
+
|
|
29
|
+
return node
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return tree.walk(process)
|
|
33
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const posthtml = require('posthtml')
|
|
2
|
-
const {get, isEmpty} = require('lodash')
|
|
3
|
-
const urlParams = require('posthtml-url-parameters')
|
|
4
|
-
|
|
5
|
-
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
-
const urlParameters = direct ? config : get(config, 'urlParameters', {})
|
|
7
|
-
|
|
8
|
-
if (!isEmpty(urlParameters)) {
|
|
9
|
-
const {_options, ...parameters} = urlParameters
|
|
10
|
-
const {tags, qs} = _options || {tags: ['a'], qs: {encode: false}}
|
|
11
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
12
|
-
|
|
13
|
-
return posthtml([urlParams({parameters, tags, qs})]).process(html, posthtmlOptions).then(result => result.html)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return html
|
|
17
|
-
}
|
|
1
|
+
const posthtml = require('posthtml')
|
|
2
|
+
const {get, isEmpty} = require('lodash')
|
|
3
|
+
const urlParams = require('posthtml-url-parameters')
|
|
4
|
+
|
|
5
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
6
|
+
const urlParameters = direct ? config : get(config, 'urlParameters', {})
|
|
7
|
+
|
|
8
|
+
if (!isEmpty(urlParameters)) {
|
|
9
|
+
const {_options, ...parameters} = urlParameters
|
|
10
|
+
const {tags, qs} = _options || {tags: ['a'], qs: {encode: false}}
|
|
11
|
+
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
12
|
+
|
|
13
|
+
return posthtml([urlParams({parameters, tags, qs})]).process(html, posthtmlOptions).then(result => result.html)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return html
|
|
17
|
+
}
|
package/src/utils/helpers.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
asyncForEach: async (array, callback) => {
|
|
3
|
-
for (let index = 0; index < array.length; index++) {
|
|
4
|
-
await callback(array[index], index, array) // eslint-disable-line
|
|
5
|
-
}
|
|
6
|
-
},
|
|
7
|
-
requireUncached: module => {
|
|
8
|
-
try {
|
|
9
|
-
delete require.cache[require.resolve(module)]
|
|
10
|
-
return require(module)
|
|
11
|
-
} catch {
|
|
12
|
-
throw new Error(`could not load ${module}`)
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
// https://github.com/lukeed/console-clear
|
|
16
|
-
clearConsole: () => process.stdout.write('\x1B[H\x1B[2J')
|
|
17
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
asyncForEach: async (array, callback) => {
|
|
3
|
+
for (let index = 0; index < array.length; index++) {
|
|
4
|
+
await callback(array[index], index, array) // eslint-disable-line
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
requireUncached: module => {
|
|
8
|
+
try {
|
|
9
|
+
delete require.cache[require.resolve(module)]
|
|
10
|
+
return require(module)
|
|
11
|
+
} catch {
|
|
12
|
+
throw new Error(`could not load ${module}`)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
// https://github.com/lukeed/console-clear
|
|
16
|
+
clearConsole: () => process.stdout.write('\x1B[H\x1B[2J')
|
|
17
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Parent
|
|
2
|
-
Child in second.html
|
|
1
|
+
Parent
|
|
2
|
+
Child in second.html
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Leanne Graham
|
|
2
|
-
|
|
3
|
-
Ervin Howell
|
|
4
|
-
|
|
5
|
-
Clementine Bauch
|
|
1
|
+
Leanne Graham
|
|
2
|
+
|
|
3
|
+
Ervin Howell
|
|
4
|
+
|
|
5
|
+
Clementine Bauch
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Environment: maizzle-ci
|
|
2
|
-
|
|
3
|
-
Front matter variable: Hello
|
|
1
|
+
Environment: maizzle-ci
|
|
2
|
+
|
|
3
|
+
Front matter variable: Hello
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html>
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</body>
|
|
3
|
+
<head>
|
|
4
|
+
<style>div {
|
|
5
|
+
margin-top: 1px;
|
|
6
|
+
margin-right: 2px;
|
|
7
|
+
margin-bottom: 3px;
|
|
8
|
+
margin-left: 4px;
|
|
9
|
+
}
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div>test</div>
|
|
14
|
+
</body>
|
|
16
15
|
</html>
|