@maizzle/framework 4.0.0-alpha.8 → 4.0.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.
Files changed (84) hide show
  1. package/.editorconfig +9 -9
  2. package/.github/media/logo-dark.svg +1 -0
  3. package/.github/media/logo-light.svg +1 -0
  4. package/.github/workflows/nodejs.yml +28 -28
  5. package/LICENSE +21 -21
  6. package/README.md +42 -35
  7. package/bin/maizzle +3 -0
  8. package/package.json +91 -87
  9. package/src/commands/serve.js +15 -5
  10. package/src/generators/config.js +32 -32
  11. package/src/generators/output/index.js +4 -4
  12. package/src/generators/output/to-disk.js +208 -208
  13. package/src/generators/output/to-string.js +67 -71
  14. package/src/generators/postcss.js +29 -29
  15. package/src/generators/posthtml.js +66 -66
  16. package/src/generators/tailwindcss.js +116 -116
  17. package/src/index.js +17 -17
  18. package/src/transformers/attributeToStyle.js +90 -90
  19. package/src/transformers/baseUrl.js +69 -45
  20. package/src/transformers/extraAttributes.js +26 -26
  21. package/src/transformers/filters/defaultFilters.js +126 -0
  22. package/src/transformers/{transform.js → filters/index.js} +55 -51
  23. package/src/transformers/index.js +63 -60
  24. package/src/transformers/inlineCss.js +37 -50
  25. package/src/transformers/markdown.js +19 -19
  26. package/src/transformers/minify.js +21 -21
  27. package/src/transformers/plaintext.js +23 -23
  28. package/src/transformers/posthtmlMso.js +10 -10
  29. package/src/transformers/prettify.js +27 -20
  30. package/src/transformers/preventWidows.js +13 -13
  31. package/src/transformers/removeAttributes.js +17 -17
  32. package/src/transformers/removeInlineBackgroundColor.js +52 -52
  33. package/src/transformers/removeInlineSizes.js +41 -41
  34. package/src/transformers/removeInlinedSelectors.js +70 -71
  35. package/src/transformers/removeUnusedCss.js +40 -35
  36. package/src/transformers/replaceStrings.js +14 -14
  37. package/src/transformers/safeClassNames.js +24 -24
  38. package/src/transformers/shorthandInlineCSS.js +19 -0
  39. package/src/transformers/sixHex.js +33 -33
  40. package/src/transformers/urlParameters.js +17 -17
  41. package/src/utils/helpers.js +17 -17
  42. package/test/expected/posthtml/component.html +13 -13
  43. package/test/expected/posthtml/extend-template.html +2 -2
  44. package/test/expected/posthtml/fetch.html +5 -5
  45. package/test/expected/posthtml/layout.html +3 -3
  46. package/test/expected/transformers/atimport-in-style.html +2 -1
  47. package/test/expected/transformers/{base-image-url.html → base-url.html} +18 -2
  48. package/test/expected/transformers/filters.html +81 -0
  49. package/test/expected/transformers/preserve-transform-css.html +12 -3
  50. package/test/expected/useConfig.html +9 -9
  51. package/test/fixtures/basic.html +6 -6
  52. package/test/fixtures/posthtml/component.html +19 -19
  53. package/test/fixtures/posthtml/extend-template.html +7 -7
  54. package/test/fixtures/posthtml/fetch.html +9 -9
  55. package/test/fixtures/posthtml/layout.html +11 -11
  56. package/test/fixtures/transformers/{base-image-url.html → base-url.html} +18 -2
  57. package/test/fixtures/transformers/filters.html +87 -0
  58. package/test/fixtures/useConfig.html +9 -9
  59. package/test/stubs/assets/foo.bar +1 -1
  60. package/test/stubs/breaking/bad.html +5 -5
  61. package/test/stubs/components/component.html +5 -5
  62. package/test/stubs/config/config.js +10 -10
  63. package/test/stubs/config/config.maizzle-ci.js +10 -10
  64. package/test/stubs/data.json +14 -14
  65. package/test/stubs/events/before-create.html +1 -1
  66. package/test/stubs/layouts/basic.html +1 -1
  67. package/test/stubs/layouts/full.html +12 -12
  68. package/test/stubs/layouts/template.html +5 -5
  69. package/test/stubs/main.css +5 -5
  70. package/test/stubs/tailwind/content-source.html +1 -1
  71. package/test/stubs/tailwind/tailwind.css +3 -3
  72. package/test/stubs/template.html +10 -10
  73. package/test/stubs/templates/1.html +1 -1
  74. package/test/stubs/templates/2.test +1 -0
  75. package/test/test-config.js +19 -19
  76. package/test/test-postcss.js +8 -8
  77. package/test/test-posthtml.js +72 -66
  78. package/test/test-tailwindcss.js +117 -117
  79. package/test/test-todisk.js +42 -28
  80. package/test/test-tostring.js +148 -142
  81. package/test/test-transformers.js +78 -46
  82. package/xo.config.js +22 -22
  83. package/test/stubs/templates/2.html +0 -1
  84. package/test/stubs/templates/3.mzl +0 -1
@@ -1,35 +1,40 @@
1
- const {comb} = require('email-comb')
2
- const {get, isEmpty} = require('lodash')
3
-
4
- module.exports = async (html, config = {}, direct = false) => {
5
- if (get(config, 'removeUnusedCSS') === false) {
6
- return html
7
- }
8
-
9
- const options = direct ? config : get(config, 'removeUnusedCSS', {})
10
-
11
- const safelist = [
12
- '*body*', // Gmail
13
- '.outlook*', // Outlook.com
14
- '.bloop_container', // Airmail
15
- '.Singleton', // Apple Mail 10
16
- '.unused', // Notes 8
17
- '.moz-text-html', // Thunderbird
18
- '.mail-detail-content', // Comcast, Libero webmail
19
- '*edo*', // Edison (all)
20
- '#*', // Freenet uses #msgBody
21
- '.lang*' // Fenced code blocks
22
- ]
23
-
24
- if (typeof options === 'boolean' && options) {
25
- return comb(html, {whitelist: safelist}).result
26
- }
27
-
28
- if (!isEmpty(options)) {
29
- options.whitelist = [...get(options, 'whitelist', []), ...safelist]
30
-
31
- return comb(html, options).result
32
- }
33
-
34
- return html
35
- }
1
+ const {comb} = require('email-comb')
2
+ const {get, isEmpty} = require('lodash')
3
+
4
+ module.exports = async (html, config = {}, direct = false) => {
5
+ if (get(config, 'removeUnusedCSS') === false) {
6
+ return html
7
+ }
8
+
9
+ const options = direct ? config : get(config, 'removeUnusedCSS', {})
10
+
11
+ const safelist = [
12
+ '*body*', // Gmail
13
+ '.gmail*', // Gmail
14
+ '.apple*', // Apple Mail
15
+ '.ios*', // Mail on iOS
16
+ '.ox-*', // Open-Xchange
17
+ '.outlook*', // Outlook.com
18
+ '.ogs*', // Outlook.com
19
+ '.bloop_container', // Airmail
20
+ '.Singleton', // Apple Mail 10
21
+ '.unused', // Notes 8
22
+ '.moz-text-html', // Thunderbird
23
+ '.mail-detail-content', // Comcast, Libero webmail
24
+ '*edo*', // Edison (all)
25
+ '#*', // Freenet uses #msgBody
26
+ '.lang*' // Fenced code blocks
27
+ ]
28
+
29
+ if (typeof options === 'boolean' && options) {
30
+ return comb(html, {whitelist: safelist}).result
31
+ }
32
+
33
+ if (!isEmpty(options)) {
34
+ options.whitelist = [...get(options, 'whitelist', []), ...safelist]
35
+
36
+ return comb(html, options).result
37
+ }
38
+
39
+ return html
40
+ }
@@ -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
+ }
@@ -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,13 +1,13 @@
1
- Variable from attribute: Example
2
-
3
- Variable from locals attribute: bar
4
-
5
-
6
- Variable from page: maizzle-ci
7
-
8
- Variable from attribute: Nested component
9
-
10
- Variable from locals attribute: bar (nested)
11
-
12
-
13
- Variable from page (nested): maizzle-ci
1
+ Variable from attribute: Example
2
+
3
+ Variable from locals attribute: bar
4
+
5
+
6
+ Variable from page: maizzle-ci
7
+
8
+ Variable from attribute: Nested component
9
+
10
+ Variable from locals attribute: bar (nested)
11
+
12
+
13
+ Variable from page (nested): maizzle-ci
@@ -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
@@ -6,7 +6,8 @@
6
6
  margin-right: 2px;
7
7
  margin-bottom: 3px;
8
8
  margin-left: 4px;
9
- }</style>
9
+ }
10
+ </style>
10
11
  </head>
11
12
  <body>
12
13
  <div>test</div>
@@ -56,13 +56,21 @@
56
56
 
57
57
  <div>
58
58
  <!--[if mso]>
59
- <v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image.jpg" style="600px;height:400px;" />
60
- <v:rect fill="false" stroke="false" style="position:absolute;600px;height:400px;">
59
+ <v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image.jpg" style="width:600px;height:400px;" />
60
+ <v:rect fill="false" stroke="false" style="position:absolute;width:600px;height:400px;">
61
61
  <v:textbox inset="0,0,0,0"><div><![endif]-->
62
62
  <div>test</div>
63
63
  <!--[if mso]></div></v:textbox></v:rect><![endif]-->
64
64
  </div>
65
65
 
66
+ <!--[if mso]>
67
+ <v:image src="https://example.com/image-2.jpg" xmlns:v="urn:schemas-microsoft-com:vml" style="width:600px;height:400px;" />
68
+ <![endif]-->
69
+
70
+ <!--[if mso]>
71
+ <v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image-3.jpg" style="width:600px;height:400px;" />
72
+ <![endif]-->
73
+
66
74
  <table>
67
75
  <tr>
68
76
  <td background="https://example.com/image.png" bgcolor="#7bceeb" width="120" height="92" valign="top">
@@ -79,5 +87,13 @@
79
87
  </td>
80
88
  </tr>
81
89
  </table>
90
+
91
+ <!--[if mso]>
92
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
93
+ <![endif]-->
94
+
95
+ <!--[if mso]>
96
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
97
+ <![endif]-->
82
98
  </body>
83
99
  </html>
@@ -0,0 +1,81 @@
1
+ <!-- Append -->
2
+ <div>testing append</div>
3
+ <!-- Prepend -->
4
+ <div>testing prepend</div>
5
+
6
+ <!-- Uppercase -->
7
+ <div>TEST</div>
8
+ <!-- Lowercase -->
9
+ <div>test</div>
10
+ <!-- Capitalize -->
11
+ <div>Test</div>
12
+
13
+ <!-- Ceil -->
14
+ <div>2</div>
15
+ <!-- Floor -->
16
+ <div>1</div>
17
+ <!-- Round -->
18
+ <div>1235</div>
19
+
20
+ <!-- Escape -->
21
+ <div>&#34;&amp;&#39;&lt;&gt;</div>
22
+ <!-- Escape Once -->
23
+ <div>1 &lt; 2 &amp; 3</div>
24
+
25
+ <!-- lstrip -->
26
+ <div>test </div>
27
+ <!-- rstrip -->
28
+ <div> test</div>
29
+ <!-- trim -->
30
+ <div>test</div>
31
+
32
+ <!-- Minus -->
33
+ <div>1.02</div>
34
+ <!-- Plus -->
35
+ <div>5.02</div>
36
+ <!-- Times -->
37
+ <div>12.08</div>
38
+ <!-- Divide -->
39
+ <div>6.04</div>
40
+ <!-- Modulo -->
41
+ <div>1</div>
42
+
43
+ <!-- Newline to br -->
44
+ <div><br> test<br> test<br></div>
45
+ <!-- Strip newlines -->
46
+ <div> test test</div>
47
+
48
+ <!-- Remove -->
49
+ <div>I sted to see the t through the </div>
50
+ <!-- Remove First -->
51
+ <div>I sted to see the train through the rain</div>
52
+
53
+ <!-- Replace -->
54
+ <div>testestest</div>
55
+ <!-- Replace First -->
56
+ <div>testest</div>
57
+
58
+ <!-- Size -->
59
+ <div>33</div>
60
+
61
+ <!-- Slice -->
62
+ <div>est</div>
63
+ <!-- Slice with endIndex -->
64
+ <div>tes</div>
65
+
66
+ <!-- Truncate -->
67
+ <div>Ground control to...</div>
68
+ <!-- Truncate (do nothing) -->
69
+ <div>Ground control to</div>
70
+ <!-- Truncate with custom ellipsis -->
71
+ <div>Ground control to no one</div>
72
+
73
+ <!-- Truncate words -->
74
+ <div>Ground control...</div>
75
+ <!-- Truncate words with custom ellipsis -->
76
+ <div>Ground control over and out</div>
77
+
78
+ <!-- URL decode -->
79
+ <div>'Stop!' said Fred</div>
80
+ <!-- URL encode -->
81
+ <div>user%40example.com</div>
@@ -9,8 +9,16 @@
9
9
  display: table !important;
10
10
  } .contents {
11
11
  display: contents !important;
12
- } .transform {
13
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;
12
+ } .truncate {
13
+ overflow: hidden !important;
14
+ text-overflow: ellipsis !important;
15
+ white-space: nowrap !important;
16
+ } .uppercase {
17
+ text-transform: uppercase !important;
18
+ } .lowercase {
19
+ text-transform: lowercase !important;
20
+ } .capitalize {
21
+ text-transform: capitalize !important;
14
22
  } div {
15
23
  text-transform: uppercase;
16
24
  } [data-ogsc] .inexistent {
@@ -19,7 +27,8 @@
19
27
  display: block !important;
20
28
  } u + #body a {
21
29
  color: inherit;
22
- }</style>
30
+ }
31
+ </style>
23
32
  </head>
24
33
  <body>
25
34
  <div>test</div>
@@ -1,9 +1,9 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>test></title>
5
- </head>
6
- <body>
7
- <div>build_production</div>
8
- </body>
9
- </html>
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>test></title>
5
+ </head>
6
+ <body>
7
+ <div>build_production</div>
8
+ </body>
9
+ </html>
@@ -1,9 +1,9 @@
1
1
  <!doctype html>
2
2
  <html>
3
- <head>
4
- <title>test></title>
5
- </head>
6
- <body>
7
- <div>test</div>
8
- </body>
3
+ <head>
4
+ <title>test></title>
5
+ </head>
6
+ <body>
7
+ <div>test</div>
8
+ </body>
9
9
  </html>
@@ -1,19 +1,19 @@
1
- <component
2
- src="test/stubs/components/component.html"
3
- text="Example"
4
- locals='{
5
- "foo": "bar"
6
- }'
7
- >
8
- Variable from page: [[ page.env ]]
9
-
10
- <component
11
- src="test/stubs/components/component.html"
12
- text="Nested component"
13
- locals='{
14
- "foo": "bar (nested)"
15
- }'
16
- >
17
- Variable from page (nested): [[ page.env ]]
18
- </component>
19
- </component>
1
+ <component
2
+ src="test/stubs/components/component.html"
3
+ text="Example"
4
+ locals='{
5
+ "foo": "bar"
6
+ }'
7
+ >
8
+ Variable from page: [[ page.env ]]
9
+
10
+ <component
11
+ src="test/stubs/components/component.html"
12
+ text="Nested component"
13
+ locals='{
14
+ "foo": "bar (nested)"
15
+ }'
16
+ >
17
+ Variable from page (nested): [[ page.env ]]
18
+ </component>
19
+ </component>
@@ -1,7 +1,7 @@
1
- ---
2
- template: second
3
- ---
4
-
5
- <extends src="test/stubs/template.html">
6
- <block name="button">Child in second.html</block>
7
- </extends>
1
+ ---
2
+ template: second
3
+ ---
4
+
5
+ <extends src="test/stubs/template.html">
6
+ <block name="button">Child in second.html</block>
7
+ </extends>
@@ -1,9 +1,9 @@
1
- <extends src="test/stubs/layouts/basic.html">
2
- <block name="template">
3
- <fetch url="test/stubs/data.json">
4
- <each loop="user in response">
5
- [[ user.name ]]
6
- </each>
7
- </fetch>
8
- </block>
9
- </extends>
1
+ <extends src="test/stubs/layouts/basic.html">
2
+ <block name="template">
3
+ <fetch url="test/stubs/data.json">
4
+ <each loop="user in response">
5
+ [[ user.name ]]
6
+ </each>
7
+ </fetch>
8
+ </block>
9
+ </extends>
@@ -1,11 +1,11 @@
1
- ---
2
- greeting: Hello
3
- ---
4
-
5
- <extends src="test/stubs/layouts/basic.html">
6
- <block name="template">
7
- Environment: {{ page.env }}
8
-
9
- Front matter variable: {{ page.greeting }}
10
- </block>
11
- </extends>
1
+ ---
2
+ greeting: Hello
3
+ ---
4
+
5
+ <extends src="test/stubs/layouts/basic.html">
6
+ <block name="template">
7
+ Environment: {{ page.env }}
8
+
9
+ Front matter variable: {{ page.greeting }}
10
+ </block>
11
+ </extends>