@maizzle/framework 4.0.0 → 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 (58) hide show
  1. package/.editorconfig +9 -9
  2. package/.github/workflows/nodejs.yml +28 -28
  3. package/LICENSE +21 -21
  4. package/bin/maizzle +3 -3
  5. package/package.json +2 -2
  6. package/src/generators/config.js +32 -32
  7. package/src/generators/output/index.js +4 -4
  8. package/src/generators/output/to-disk.js +208 -208
  9. package/src/generators/output/to-string.js +67 -67
  10. package/src/generators/postcss.js +29 -29
  11. package/src/generators/posthtml.js +66 -66
  12. package/src/index.js +17 -17
  13. package/src/transformers/attributeToStyle.js +90 -90
  14. package/src/transformers/baseUrl.js +69 -69
  15. package/src/transformers/extraAttributes.js +26 -26
  16. package/src/transformers/filters/defaultFilters.js +126 -126
  17. package/src/transformers/filters/index.js +55 -55
  18. package/src/transformers/inlineCss.js +37 -37
  19. package/src/transformers/markdown.js +19 -19
  20. package/src/transformers/minify.js +21 -21
  21. package/src/transformers/plaintext.js +23 -23
  22. package/src/transformers/posthtmlMso.js +10 -10
  23. package/src/transformers/prettify.js +27 -27
  24. package/src/transformers/preventWidows.js +13 -13
  25. package/src/transformers/removeAttributes.js +17 -17
  26. package/src/transformers/removeInlineBackgroundColor.js +52 -52
  27. package/src/transformers/removeInlineSizes.js +41 -41
  28. package/src/transformers/replaceStrings.js +14 -14
  29. package/src/transformers/safeClassNames.js +24 -24
  30. package/src/transformers/shorthandInlineCSS.js +19 -19
  31. package/src/transformers/sixHex.js +33 -33
  32. package/src/transformers/urlParameters.js +17 -17
  33. package/src/utils/helpers.js +17 -17
  34. package/test/expected/posthtml/extend-template.html +2 -2
  35. package/test/expected/posthtml/fetch.html +5 -5
  36. package/test/expected/posthtml/layout.html +3 -3
  37. package/test/expected/transformers/base-url.html +99 -99
  38. package/test/fixtures/posthtml/extend-template.html +7 -7
  39. package/test/fixtures/posthtml/fetch.html +9 -9
  40. package/test/fixtures/posthtml/layout.html +11 -11
  41. package/test/fixtures/transformers/base-url.html +101 -101
  42. package/test/stubs/assets/foo.bar +1 -1
  43. package/test/stubs/breaking/bad.html +5 -5
  44. package/test/stubs/config/config.js +10 -10
  45. package/test/stubs/config/config.maizzle-ci.js +10 -10
  46. package/test/stubs/data.json +14 -14
  47. package/test/stubs/events/before-create.html +1 -1
  48. package/test/stubs/layouts/basic.html +1 -1
  49. package/test/stubs/layouts/full.html +12 -12
  50. package/test/stubs/layouts/template.html +5 -5
  51. package/test/stubs/main.css +5 -5
  52. package/test/stubs/tailwind/content-source.html +1 -1
  53. package/test/stubs/tailwind/tailwind.css +3 -3
  54. package/test/stubs/template.html +10 -10
  55. package/test/test-posthtml.js +72 -72
  56. package/test/test-todisk.js +511 -511
  57. package/test/test-transformers.js +1 -0
  58. package/xo.config.js +22 -22
@@ -1 +1 @@
1
- Foo is {{ page.foo }}
1
+ Foo is {{ page.foo }}
@@ -1 +1 @@
1
- <block name="template"></block>
1
+ <block name="template"></block>
@@ -1,12 +1,12 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <if condition="page.css">
5
- <style>{{{ page.css }}}</style>
6
- </if>
7
- </head>
8
- <body>
9
- <block name="template"></block>
10
- </body>
11
- </html>
12
-
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <if condition="page.css">
5
+ <style>{{{ page.css }}}</style>
6
+ </if>
7
+ </head>
8
+ <body>
9
+ <block name="template"></block>
10
+ </body>
11
+ </html>
12
+
@@ -1,5 +1,5 @@
1
- ---
2
- template: base
3
- ---
4
-
5
- <block name="template"></block>
1
+ ---
2
+ template: base
3
+ ---
4
+
5
+ <block name="template"></block>
@@ -1,5 +1,5 @@
1
- @import "tailwindcss/utilities";
2
-
3
- .foo {
4
- color: red;
5
- }
1
+ @import "tailwindcss/utilities";
2
+
3
+ .foo {
4
+ color: red;
5
+ }
@@ -1 +1 @@
1
- <div class="hidden"></div>
1
+ <div class="hidden"></div>
@@ -1,3 +1,3 @@
1
- .example {
2
- @apply hidden;
3
- }
1
+ .example {
2
+ @apply hidden;
3
+ }
@@ -1,10 +1,10 @@
1
- ---
2
- template: first
3
- ---
4
-
5
- <extends src="test/stubs/layouts/template.html">
6
- <block name="template">
7
- Parent
8
- <block name="button">Child in first.html</block>
9
- </block>
10
- </extends>
1
+ ---
2
+ template: first
3
+ ---
4
+
5
+ <extends src="test/stubs/layouts/template.html">
6
+ <block name="template">
7
+ Parent
8
+ <block name="button">Child in first.html</block>
9
+ </block>
10
+ </extends>
@@ -1,72 +1,72 @@
1
- const test = require('ava')
2
- const Maizzle = require('../src')
3
-
4
- const path = require('path')
5
- const fs = require('fs')
6
-
7
- const readFile = (dir, filename) => fs.promises
8
- .readFile(path.join(__dirname, dir, `${filename}.html`), 'utf8')
9
- .then(html => html.trim())
10
-
11
- const fixture = file => readFile('fixtures', file)
12
- const expected = file => readFile('expected', file)
13
-
14
- const renderString = (string, options = {}) => Maizzle.render(string, options).then(({html}) => html)
15
-
16
- test('layouts', async t => {
17
- const source = await fixture('posthtml/layout')
18
-
19
- const html = await renderString(source, {maizzle: {env: 'maizzle-ci'}})
20
-
21
- t.is(html.trim(), await expected('posthtml/layout'))
22
- })
23
-
24
- test('inheritance when extending a template', async t => {
25
- const source = await fixture('posthtml/extend-template')
26
- let html = await renderString(source)
27
-
28
- html = html.replace(/[^\S\r\n]+$/gm, '').trim()
29
-
30
- t.is(html, await expected('posthtml/extend-template'))
31
- })
32
-
33
- test('components', async t => {
34
- const source = await fixture('posthtml/component')
35
- const options = {
36
- maizzle: {
37
- env: 'maizzle-ci',
38
- build: {
39
- components: {
40
- expressions: {
41
- delimiters: ['[[', ']]']
42
- }
43
- }
44
- }
45
- }
46
- }
47
-
48
- const html = await renderString(source, options)
49
-
50
- t.is(html.trim(), await expected('posthtml/component'))
51
- })
52
-
53
- test('fetch component', async t => {
54
- const source = await fixture('posthtml/fetch')
55
- const options = {
56
- maizzle: {
57
- env: 'maizzle-ci',
58
- build: {
59
- posthtml: {
60
- expressions: {
61
- delimiters: ['[[', ']]']
62
- }
63
- }
64
- }
65
- }
66
- }
67
-
68
- let html = await renderString(source, options)
69
- html = html.replace(/[^\S\r\n]+$/gm, '')
70
-
71
- t.is(html.trim(), await expected('posthtml/fetch'))
72
- })
1
+ const test = require('ava')
2
+ const Maizzle = require('../src')
3
+
4
+ const path = require('path')
5
+ const fs = require('fs')
6
+
7
+ const readFile = (dir, filename) => fs.promises
8
+ .readFile(path.join(__dirname, dir, `${filename}.html`), 'utf8')
9
+ .then(html => html.trim())
10
+
11
+ const fixture = file => readFile('fixtures', file)
12
+ const expected = file => readFile('expected', file)
13
+
14
+ const renderString = (string, options = {}) => Maizzle.render(string, options).then(({html}) => html)
15
+
16
+ test('layouts', async t => {
17
+ const source = await fixture('posthtml/layout')
18
+
19
+ const html = await renderString(source, {maizzle: {env: 'maizzle-ci'}})
20
+
21
+ t.is(html.trim(), await expected('posthtml/layout'))
22
+ })
23
+
24
+ test('inheritance when extending a template', async t => {
25
+ const source = await fixture('posthtml/extend-template')
26
+ let html = await renderString(source)
27
+
28
+ html = html.replace(/[^\S\r\n]+$/gm, '').trim()
29
+
30
+ t.is(html, await expected('posthtml/extend-template'))
31
+ })
32
+
33
+ test('components', async t => {
34
+ const source = await fixture('posthtml/component')
35
+ const options = {
36
+ maizzle: {
37
+ env: 'maizzle-ci',
38
+ build: {
39
+ components: {
40
+ expressions: {
41
+ delimiters: ['[[', ']]']
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ const html = await renderString(source, options)
49
+
50
+ t.is(html.trim(), await expected('posthtml/component'))
51
+ })
52
+
53
+ test('fetch component', async t => {
54
+ const source = await fixture('posthtml/fetch')
55
+ const options = {
56
+ maizzle: {
57
+ env: 'maizzle-ci',
58
+ build: {
59
+ posthtml: {
60
+ expressions: {
61
+ delimiters: ['[[', ']]']
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ let html = await renderString(source, options)
69
+ html = html.replace(/[^\S\r\n]+$/gm, '')
70
+
71
+ t.is(html.trim(), await expected('posthtml/fetch'))
72
+ })