@maizzle/framework 4.0.0-alpha.6 → 4.0.0-alpha.9
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/.github/workflows/nodejs.yml +1 -1
- package/bin/maizzle +3 -0
- package/package.json +12 -7
- package/src/commands/serve.js +36 -19
- package/src/generators/output/to-string.js +71 -71
- package/src/generators/postcss.js +29 -0
- package/src/generators/posthtml.js +66 -61
- package/src/generators/tailwindcss.js +1 -1
- package/src/index.js +17 -13
- package/src/transformers/baseUrl.js +33 -9
- package/src/transformers/filters/defaultFilters.js +126 -0
- package/src/transformers/filters/index.js +55 -0
- package/src/transformers/index.js +60 -57
- package/src/transformers/inlineCss.js +1 -1
- package/src/transformers/minify.js +1 -1
- package/src/transformers/prettify.js +29 -20
- package/src/transformers/removeInlineBackgroundColor.js +1 -1
- package/src/transformers/removeInlinedSelectors.js +70 -0
- package/src/transformers/removeUnusedCss.js +40 -20
- package/src/transformers/sixHex.js +24 -1
- package/test/expected/posthtml/component.html +13 -0
- package/test/expected/{inheritance.html → posthtml/extend-template.html} +2 -2
- package/test/expected/posthtml/fetch.html +5 -0
- package/test/expected/posthtml/layout.html +3 -0
- package/test/expected/transformers/atimport-in-style.html +16 -0
- package/test/expected/transformers/{base-image-url.html → base-url.html} +18 -2
- package/test/expected/transformers/filters.html +81 -0
- package/test/expected/transformers/preserve-transform-css.html +48 -0
- package/test/expected/useConfig.html +9 -9
- package/test/fixtures/basic.html +6 -6
- package/test/fixtures/posthtml/component.html +19 -0
- package/test/fixtures/{inheritance.html → posthtml/extend-template.html} +7 -7
- package/test/fixtures/posthtml/fetch.html +9 -0
- package/test/fixtures/posthtml/layout.html +11 -0
- package/test/fixtures/transformers/atimport-in-style.html +11 -0
- package/test/fixtures/transformers/{base-image-url.html → base-url.html} +18 -2
- package/test/fixtures/transformers/filters.html +87 -0
- package/test/fixtures/transformers/preserve-transform-css.html +25 -0
- package/test/fixtures/useConfig.html +9 -9
- package/test/stubs/components/component.html +5 -0
- package/test/stubs/data.json +14 -0
- package/test/stubs/layouts/basic.html +1 -0
- package/test/stubs/{layout.html → layouts/full.html} +0 -0
- package/test/stubs/{layout-basic.html → layouts/template.html} +5 -5
- package/test/stubs/post.css +6 -0
- package/test/stubs/tailwind/{preserve.html → content-source.html} +0 -0
- package/test/stubs/tailwind/tailwind.css +3 -0
- package/test/stubs/template.html +10 -10
- package/test/stubs/templates/1.html +1 -1
- package/test/stubs/templates/2.test +1 -0
- package/test/test-postcss.js +8 -0
- package/test/test-posthtml.js +66 -0
- package/test/{test-tailwind.js → test-tailwindcss.js} +4 -4
- package/test/test-todisk.js +43 -29
- package/test/test-tostring.js +32 -16
- package/test/test-transformers.js +173 -26
- package/src/transformers/transform.js +0 -22
- package/test/expected/transformers/transform-postcss.html +0 -19
- package/test/stubs/templates/2.html +0 -1
- package/test/stubs/templates/3.mzl +0 -1
|
@@ -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>"&'<></div>
|
|
22
|
+
<!-- Escape Once -->
|
|
23
|
+
<div>1 < 2 & 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>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style data-embed="">
|
|
5
|
+
.block {
|
|
6
|
+
display: block !important;
|
|
7
|
+
}
|
|
8
|
+
.inline {
|
|
9
|
+
display: inline !important;
|
|
10
|
+
}
|
|
11
|
+
.table {
|
|
12
|
+
display: table !important;
|
|
13
|
+
}
|
|
14
|
+
.contents {
|
|
15
|
+
display: contents !important;
|
|
16
|
+
}
|
|
17
|
+
.truncate {
|
|
18
|
+
overflow: hidden !important;
|
|
19
|
+
text-overflow: ellipsis !important;
|
|
20
|
+
white-space: nowrap !important;
|
|
21
|
+
}
|
|
22
|
+
.uppercase {
|
|
23
|
+
text-transform: uppercase !important;
|
|
24
|
+
}
|
|
25
|
+
.lowercase {
|
|
26
|
+
text-transform: lowercase !important;
|
|
27
|
+
}
|
|
28
|
+
.capitalize {
|
|
29
|
+
text-transform: capitalize !important;
|
|
30
|
+
}
|
|
31
|
+
div {
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
}
|
|
34
|
+
[data-ogsc] .inexistent {
|
|
35
|
+
color: #ef4444;
|
|
36
|
+
}
|
|
37
|
+
div > u + .body .gmail-android-block {
|
|
38
|
+
display: block !important;
|
|
39
|
+
}
|
|
40
|
+
u + #body a {
|
|
41
|
+
color: inherit;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
<div>test</div>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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>
|
package/test/fixtures/basic.html
CHANGED
|
@@ -0,0 +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,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>
|
|
@@ -58,13 +58,21 @@
|
|
|
58
58
|
|
|
59
59
|
<div>
|
|
60
60
|
<!--[if mso]>
|
|
61
|
-
<v:image xmlns:v="urn:schemas-microsoft-com:vml" src="image.jpg" style="600px;height:400px;" />
|
|
62
|
-
<v:rect fill="false" stroke="false" style="position:absolute;600px;height:400px;">
|
|
61
|
+
<v:image xmlns:v="urn:schemas-microsoft-com:vml" src="image.jpg" style="width:600px;height:400px;" />
|
|
62
|
+
<v:rect fill="false" stroke="false" style="position:absolute;width:600px;height:400px;">
|
|
63
63
|
<v:textbox inset="0,0,0,0"><div><![endif]-->
|
|
64
64
|
<div>test</div>
|
|
65
65
|
<!--[if mso]></div></v:textbox></v:rect><![endif]-->
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
|
+
<!--[if mso]>
|
|
69
|
+
<v:image src="image-2.jpg" xmlns:v="urn:schemas-microsoft-com:vml" style="width:600px;height:400px;" />
|
|
70
|
+
<![endif]-->
|
|
71
|
+
|
|
72
|
+
<!--[if mso]>
|
|
73
|
+
<v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image-3.jpg" style="width:600px;height:400px;" />
|
|
74
|
+
<![endif]-->
|
|
75
|
+
|
|
68
76
|
<table>
|
|
69
77
|
<tr>
|
|
70
78
|
<td background="image.png" bgcolor="#7bceeb" width="120" height="92" valign="top">
|
|
@@ -81,5 +89,13 @@
|
|
|
81
89
|
</td>
|
|
82
90
|
</tr>
|
|
83
91
|
</table>
|
|
92
|
+
|
|
93
|
+
<!--[if mso]>
|
|
94
|
+
<v:fill type="tile" src="image.png" color="#7bceeb" />
|
|
95
|
+
<![endif]-->
|
|
96
|
+
|
|
97
|
+
<!--[if mso]>
|
|
98
|
+
<v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
|
|
99
|
+
<![endif]-->
|
|
84
100
|
</body>
|
|
85
101
|
</html>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!-- Append -->
|
|
2
|
+
<div append="ing append">test</div>
|
|
3
|
+
<!-- Prepend -->
|
|
4
|
+
<div prepend="test">ing prepend</div>
|
|
5
|
+
|
|
6
|
+
<!-- Uppercase -->
|
|
7
|
+
<div uppercase>test</div>
|
|
8
|
+
<!-- Lowercase -->
|
|
9
|
+
<div lowercase>TEST</div>
|
|
10
|
+
<!-- Capitalize -->
|
|
11
|
+
<div capitalize>test</div>
|
|
12
|
+
|
|
13
|
+
<!-- Ceil -->
|
|
14
|
+
<div ceil>1.2</div>
|
|
15
|
+
<!-- Floor -->
|
|
16
|
+
<div floor>1.2</div>
|
|
17
|
+
<!-- Round -->
|
|
18
|
+
<div round>1234.567</div>
|
|
19
|
+
|
|
20
|
+
<!-- Escape -->
|
|
21
|
+
<div escape>"&'<></div>
|
|
22
|
+
<!-- Escape Once -->
|
|
23
|
+
<div escape-once>1 < 2 & 3</div>
|
|
24
|
+
|
|
25
|
+
<!-- lstrip -->
|
|
26
|
+
<div lstrip> test </div>
|
|
27
|
+
<!-- rstrip -->
|
|
28
|
+
<div rstrip> test </div>
|
|
29
|
+
<!-- trim -->
|
|
30
|
+
<div trim> test </div>
|
|
31
|
+
|
|
32
|
+
<!-- Minus -->
|
|
33
|
+
<div minus="2">3.02</div>
|
|
34
|
+
<!-- Plus -->
|
|
35
|
+
<div plus="2">3.02</div>
|
|
36
|
+
<!-- Times -->
|
|
37
|
+
<div times="2">6.04</div>
|
|
38
|
+
<!-- Divide -->
|
|
39
|
+
<div divide-by="2">12.08</div>
|
|
40
|
+
<!-- Modulo -->
|
|
41
|
+
<div modulo="2">3</div>
|
|
42
|
+
|
|
43
|
+
<!-- Newline to br -->
|
|
44
|
+
<div newline-to-br>
|
|
45
|
+
test
|
|
46
|
+
test
|
|
47
|
+
</div>
|
|
48
|
+
<!-- Strip newlines -->
|
|
49
|
+
<div strip-newlines>
|
|
50
|
+
test
|
|
51
|
+
test
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<!-- Remove -->
|
|
55
|
+
<div remove="rain">I strained to see the train through the rain</div>
|
|
56
|
+
<!-- Remove First -->
|
|
57
|
+
<div remove-first="rain">I strained to see the train through the rain</div>
|
|
58
|
+
|
|
59
|
+
<!-- Replace -->
|
|
60
|
+
<div replace="t|test">test</div>
|
|
61
|
+
<!-- Replace First -->
|
|
62
|
+
<div replace-first="t|test">test</div>
|
|
63
|
+
|
|
64
|
+
<!-- Size -->
|
|
65
|
+
<div size>This string is 33 characters long</div>
|
|
66
|
+
|
|
67
|
+
<!-- Slice -->
|
|
68
|
+
<div slice="1">test</div>
|
|
69
|
+
<!-- Slice with endIndex -->
|
|
70
|
+
<div slice="0,-1">test</div>
|
|
71
|
+
|
|
72
|
+
<!-- Truncate -->
|
|
73
|
+
<div truncate="17">Ground control to Major Tom.</div>
|
|
74
|
+
<!-- Truncate (do nothing) -->
|
|
75
|
+
<div truncate="17">Ground control to</div>
|
|
76
|
+
<!-- Truncate with custom ellipsis -->
|
|
77
|
+
<div truncate="17, no one">Ground control to Major Tom.</div>
|
|
78
|
+
|
|
79
|
+
<!-- Truncate words -->
|
|
80
|
+
<div truncate-words="2">Ground control to Major Tom.</div>
|
|
81
|
+
<!-- Truncate words with custom ellipsis -->
|
|
82
|
+
<div truncate-words="2, over and out">Ground control to Major Tom.</div>
|
|
83
|
+
|
|
84
|
+
<!-- URL decode -->
|
|
85
|
+
<div url-decode>%27Stop%21%27+said+Fred</div>
|
|
86
|
+
<!-- URL encode -->
|
|
87
|
+
<div url-encode>user@example.com</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style tailwindcss preserve>
|
|
5
|
+
div {
|
|
6
|
+
@apply uppercase;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[data-ogsc] .inexistent {
|
|
10
|
+
color: #ef4444;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
div > u + .body .gmail-android-block {
|
|
14
|
+
display: block !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
u + #body a {
|
|
18
|
+
color: inherit;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<div>test</div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>test></title>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<div>{{ page.build.templates.destination.path }}</div>
|
|
8
|
-
</body>
|
|
9
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>test></title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div>{{ page.build.templates.destination.path }}</div>
|
|
8
|
+
</body>
|
|
9
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<block name="template"></block>
|
|
File without changes
|
|
@@ -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>
|
|
File without changes
|
package/test/stubs/template.html
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
---
|
|
2
|
-
template: first
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<extends src="test/stubs/
|
|
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 +1 @@
|
|
|
1
|
-
|
|
1
|
+
html
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
test
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const test = require('ava')
|
|
2
|
+
const PostCSS = require('../src/generators/postcss')
|
|
3
|
+
|
|
4
|
+
test('throws on processing error', async t => {
|
|
5
|
+
await t.throwsAsync(async () => {
|
|
6
|
+
await PostCSS.process(null, {})
|
|
7
|
+
}, {instanceOf: Error, message: 'PostCSS processing failed'})
|
|
8
|
+
})
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const test = require('ava')
|
|
2
|
+
const Maizzle = require('../src')
|
|
3
|
+
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const {readFileSync} = require('fs')
|
|
6
|
+
|
|
7
|
+
const fixture = file => readFileSync(path.join(__dirname, 'fixtures', `${file}.html`), 'utf8')
|
|
8
|
+
const expected = file => readFileSync(path.join(__dirname, 'expected', `${file}.html`), 'utf8')
|
|
9
|
+
|
|
10
|
+
const renderString = (string, options = {}) => Maizzle.render(string, options).then(({html}) => html)
|
|
11
|
+
|
|
12
|
+
test('layouts', async t => {
|
|
13
|
+
const source = fixture('posthtml/layout')
|
|
14
|
+
|
|
15
|
+
const html = await renderString(source, {maizzle: {env: 'maizzle-ci'}})
|
|
16
|
+
|
|
17
|
+
t.is(html.trim(), expected('posthtml/layout').trim())
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('inheritance when extending a template', async t => {
|
|
21
|
+
let html = await renderString(fixture('posthtml/extend-template'))
|
|
22
|
+
html = html.replace(/[^\S\r\n]+$/gm, '').trim()
|
|
23
|
+
|
|
24
|
+
t.is(html, expected('posthtml/extend-template').trim())
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('components', async t => {
|
|
28
|
+
const source = fixture('posthtml/component')
|
|
29
|
+
const options = {
|
|
30
|
+
maizzle: {
|
|
31
|
+
env: 'maizzle-ci',
|
|
32
|
+
build: {
|
|
33
|
+
components: {
|
|
34
|
+
expressions: {
|
|
35
|
+
delimiters: ['[[', ']]']
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const html = await renderString(source, options)
|
|
43
|
+
|
|
44
|
+
t.is(html.trim(), expected('posthtml/component').trim())
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('fetch component', async t => {
|
|
48
|
+
const source = fixture('posthtml/fetch')
|
|
49
|
+
const options = {
|
|
50
|
+
maizzle: {
|
|
51
|
+
env: 'maizzle-ci',
|
|
52
|
+
build: {
|
|
53
|
+
posthtml: {
|
|
54
|
+
expressions: {
|
|
55
|
+
delimiters: ['[[', ']]']
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let html = await renderString(source, options)
|
|
63
|
+
html = html.replace(/[^\S\r\n]+$/gm, '')
|
|
64
|
+
|
|
65
|
+
t.is(html.trim(), expected('posthtml/fetch').trim())
|
|
66
|
+
})
|
|
@@ -9,7 +9,7 @@ test('throws on compile error', async t => {
|
|
|
9
9
|
}, {instanceOf: Error, message: 'Tailwind CSS compilation failed'})
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
test('uses
|
|
12
|
+
test('uses defaults if no config specified', async t => {
|
|
13
13
|
const css = await Tailwind.compile(
|
|
14
14
|
'@tailwind utilities;',
|
|
15
15
|
'<p class="xl:z-0"></p>',
|
|
@@ -21,7 +21,7 @@ test('uses Tailwind defaults if no config specified', async t => {
|
|
|
21
21
|
t.true(css.includes('.xl\\:z-0'))
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
test('uses
|
|
24
|
+
test('uses css file provided in environment config', async t => {
|
|
25
25
|
const config = {
|
|
26
26
|
env: 'production',
|
|
27
27
|
build: {
|
|
@@ -89,7 +89,7 @@ test('uses maizzle template path as content source (single file)', async t => {
|
|
|
89
89
|
{
|
|
90
90
|
build: {
|
|
91
91
|
templates: {
|
|
92
|
-
source: './test/stubs/tailwind/
|
|
92
|
+
source: './test/stubs/tailwind/content-source.html'
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -113,5 +113,5 @@ test('uses custom postcss plugins from the maizzle config', async t => {
|
|
|
113
113
|
const css = await Tailwind.compile('.test {transform: scale(0.5)}', '<div class="test">Test</a>', {}, maizzleConfig)
|
|
114
114
|
|
|
115
115
|
t.not(css, undefined)
|
|
116
|
-
t.is(css.trim(), '.inline {display: inline !important} .table {display: table !important} .contents {display: contents !important} .
|
|
116
|
+
t.is(css.trim(), '.inline {display: inline !important} .table {display: table !important} .contents {display: contents !important} .truncate {overflow: hidden !important;text-overflow: ellipsis !important;white-space: nowrap !important} .uppercase {text-transform: uppercase !important} .lowercase {text-transform: lowercase !important} .capitalize {text-transform: capitalize !important} .test {-webkit-transform: scale(0.5);transform: scale(0.5)}')
|
|
117
117
|
})
|