@maizzle/framework 3.7.3 → 4.0.0-alpha.3

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 (42) hide show
  1. package/.github/workflows/nodejs.yml +0 -1
  2. package/package.json +15 -13
  3. package/src/commands/build.js +32 -0
  4. package/src/commands/serve.js +139 -0
  5. package/src/functions/plaintext.js +5 -0
  6. package/src/functions/render.js +5 -0
  7. package/src/generators/output/to-disk.js +208 -167
  8. package/src/generators/output/to-string.js +5 -2
  9. package/src/generators/plaintext.js +49 -52
  10. package/src/generators/posthtml.js +61 -60
  11. package/src/generators/tailwindcss.js +114 -84
  12. package/src/index.js +13 -163
  13. package/src/transformers/{attribute-to-style.js → attributeToStyle.js} +0 -0
  14. package/src/transformers/baseUrl.js +45 -0
  15. package/src/transformers/{extra-attributes.js → extraAttributes.js} +0 -0
  16. package/src/transformers/index.js +57 -57
  17. package/src/transformers/{inline.js → inlineCss.js} +0 -0
  18. package/src/transformers/{posthtml-mso.js → posthtmlMso.js} +0 -0
  19. package/src/transformers/{prevent-widows.js → preventWidows.js} +0 -0
  20. package/src/transformers/{remove-attributes.js → removeAttributes.js} +1 -1
  21. package/src/transformers/{remove-inline-bgcolor.js → removeInlineBackgroundColor.js} +0 -0
  22. package/src/transformers/{remove-inline-sizes.js → removeInlineSizes.js} +0 -0
  23. package/src/transformers/{remove-unused-css.js → removeUnusedCss.js} +0 -0
  24. package/src/transformers/{replace-strings.js → replaceStrings.js} +0 -0
  25. package/src/transformers/{safe-class-names.js → safeClassNames.js} +8 -2
  26. package/src/transformers/{six-hex.js → sixHex.js} +0 -0
  27. package/src/transformers/transform.js +4 -6
  28. package/src/transformers/{url-params.js → urlParameters.js} +0 -0
  29. package/src/utils/helpers.js +2 -8
  30. package/test/expected/transformers/base-image-url.html +82 -6
  31. package/test/expected/transformers/transform-postcss.html +19 -0
  32. package/test/expected/useConfig.html +9 -0
  33. package/test/fixtures/basic.html +9 -9
  34. package/test/fixtures/transformers/base-image-url.html +84 -6
  35. package/test/fixtures/useConfig.html +9 -0
  36. package/test/stubs/tailwind/preserve.html +1 -0
  37. package/test/test-tailwind.js +68 -24
  38. package/test/test-todisk.js +497 -418
  39. package/test/test-tostring.js +132 -124
  40. package/test/test-transformers.js +25 -2
  41. package/xo.config.js +3 -0
  42. package/src/transformers/base-image-url.js +0 -9
@@ -1,57 +1,57 @@
1
- const inline = require('./inline')
2
- const minify = require('./minify')
3
- const markdown = require('./markdown')
4
- const prettify = require('./prettify')
5
- const ensureSixHEX = require('./six-hex')
6
- const addURLParams = require('./url-params')
7
- const transformContents = require('./transform')
8
- const preventWidows = require('./prevent-widows')
9
- const replaceStrings = require('./replace-strings')
10
- const safeClassNames = require('./safe-class-names')
11
- const applyBaseImageUrl = require('./base-image-url')
12
- const removeUnusedCSS = require('./remove-unused-css')
13
- const removeAttributes = require('./remove-attributes')
14
- const attributeToStyle = require('./attribute-to-style')
15
- const removeInlineSizes = require('./remove-inline-sizes')
16
- const applyExtraAttributes = require('./extra-attributes')
17
- const removeInlineBgColor = require('./remove-inline-bgcolor')
18
-
19
- exports.process = async (html, config) => {
20
- html = await safeClassNames(html, config)
21
- html = await transformContents(html, config)
22
- html = await markdown(html, config)
23
- html = await preventWidows(html, config)
24
- html = await attributeToStyle(html, config)
25
- html = await inline(html, config)
26
- html = await removeUnusedCSS(html, config)
27
- html = await removeInlineSizes(html, config)
28
- html = await removeInlineBgColor(html, config)
29
- html = await removeAttributes(html, config)
30
- html = await applyExtraAttributes(html, config)
31
- html = await applyBaseImageUrl(html, config)
32
- html = await addURLParams(html, config)
33
- html = await ensureSixHEX(html, config)
34
- html = await prettify(html, config)
35
- html = await minify(html, config)
36
- html = await replaceStrings(html, config)
37
-
38
- return html
39
- }
40
-
41
- exports.inlineCSS = (html, config) => inline(html, config, true)
42
- exports.minify = (html, config) => minify(html, config, true)
43
- exports.markdown = (html, config) => markdown(html, config, true)
44
- exports.prettify = (html, config) => prettify(html, config, true)
45
- exports.ensureSixHEX = (html, config) => ensureSixHEX(html, config)
46
- exports.addURLParams = (html, config) => addURLParams(html, config, true)
47
- exports.transformContents = (html, config) => transformContents(html, config, true)
48
- exports.preventWidows = (html, config) => preventWidows(html, config, true)
49
- exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
50
- exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
51
- exports.applyBaseImageUrl = (html, config) => applyBaseImageUrl(html, config, true)
52
- exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
53
- exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
54
- exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
55
- exports.applyExtraAttributes = (html, config) => applyExtraAttributes(html, config, true)
56
- exports.removeInlineBgColor = (html, config) => removeInlineBgColor(html, config, true)
57
- exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
1
+ const inline = require('./inlineCss')
2
+ const minify = require('./minify')
3
+ const markdown = require('./markdown')
4
+ const prettify = require('./prettify')
5
+ const ensureSixHEX = require('./sixHex')
6
+ const applyBaseImageUrl = require('./baseUrl')
7
+ const addURLParams = require('./urlParameters')
8
+ const transformContents = require('./transform')
9
+ const preventWidows = require('./preventWidows')
10
+ const replaceStrings = require('./replaceStrings')
11
+ const safeClassNames = require('./safeClassNames')
12
+ const removeUnusedCSS = require('./removeUnusedCss')
13
+ const removeAttributes = require('./removeAttributes')
14
+ const attributeToStyle = require('./attributeToStyle')
15
+ const removeInlineSizes = require('./removeInlineSizes')
16
+ const applyExtraAttributes = require('./extraAttributes')
17
+ const removeInlineBgColor = require('./removeInlineBackgroundColor')
18
+
19
+ exports.process = async (html, config) => {
20
+ html = await safeClassNames(html, config)
21
+ html = await transformContents(html, config)
22
+ html = await markdown(html, config)
23
+ html = await preventWidows(html, config)
24
+ html = await attributeToStyle(html, config)
25
+ html = await inline(html, config)
26
+ html = await removeUnusedCSS(html, config)
27
+ html = await removeInlineSizes(html, config)
28
+ html = await removeInlineBgColor(html, config)
29
+ html = await removeAttributes(html, config)
30
+ html = await applyExtraAttributes(html, config)
31
+ html = await applyBaseImageUrl(html, config)
32
+ html = await addURLParams(html, config)
33
+ html = await ensureSixHEX(html, config)
34
+ html = await prettify(html, config)
35
+ html = await minify(html, config)
36
+ html = await replaceStrings(html, config)
37
+
38
+ return html
39
+ }
40
+
41
+ exports.inlineCSS = (html, config) => inline(html, config, true)
42
+ exports.minify = (html, config) => minify(html, config, true)
43
+ exports.markdown = (html, config) => markdown(html, config, true)
44
+ exports.prettify = (html, config) => prettify(html, config, true)
45
+ exports.ensureSixHEX = (html, config) => ensureSixHEX(html, config)
46
+ exports.addURLParams = (html, config) => addURLParams(html, config, true)
47
+ exports.transformContents = (html, config) => transformContents(html, config, true)
48
+ exports.preventWidows = (html, config) => preventWidows(html, config, true)
49
+ exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
50
+ exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
51
+ exports.applyBaseImageUrl = (html, config) => applyBaseImageUrl(html, config, true)
52
+ exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
53
+ exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
54
+ exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
55
+ exports.applyExtraAttributes = (html, config) => applyExtraAttributes(html, config, true)
56
+ exports.removeInlineBgColor = (html, config) => removeInlineBgColor(html, config, true)
57
+ exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
File without changes
@@ -8,7 +8,7 @@ module.exports = async (html, config = {}, direct = false) => {
8
8
 
9
9
  attributes.push({name: 'style'}, {name: 'class'})
10
10
 
11
- // Allow ommiting `value` key when removing empty attributes
11
+ // Allow omitting `value` key when removing empty attributes
12
12
  attributes.forEach(attr => {
13
13
  attr.value = attr.value || ''
14
14
  })
@@ -3,11 +3,17 @@ const posthtml = require('posthtml')
3
3
  const safeClassNames = require('posthtml-safe-class-names')
4
4
 
5
5
  module.exports = async (html, config = {}, direct = false) => {
6
- if (get(config, 'safeClassNames') === false) {
6
+ const option = get(config, 'safeClassNames')
7
+
8
+ if (option === false) {
7
9
  return html
8
10
  }
9
11
 
10
- if (config.env === 'local') {
12
+ /*
13
+ * Setting it to `true` in the config will run `safeClassNames`
14
+ * no matter the environment.
15
+ */
16
+ if (config.env === 'local' && !option) {
11
17
  return html
12
18
  }
13
19
 
File without changes
@@ -13,12 +13,10 @@ module.exports = async (html, config = {}, direct = false) => {
13
13
  const maizzleConfig = omit(config, ['build.tailwind.css', 'css'])
14
14
  const tailwindConfig = get(config, 'build.tailwind.config', 'tailwind.config.js')
15
15
 
16
- replacements.postcss = css => Tailwind.compile(
17
- `@tailwind components; @tailwind utilities; ${css}`,
18
- html,
19
- tailwindConfig,
20
- maizzleConfig
21
- )
16
+ const compileCss = css => Tailwind.compile(css, html, tailwindConfig, maizzleConfig)
17
+
18
+ replacements.tailwindcss = css => compileCss(`@tailwind components; @tailwind utilities; ${css}`)
19
+ replacements.postcss = css => compileCss(`@tailwind components; @tailwind utilities; ${css}`)
22
20
 
23
21
  return posthtml([posthtmlContent(replacements)]).process(html, posthtmlOptions).then(result => result.html)
24
22
  }
@@ -1,5 +1,3 @@
1
- const readline = require('readline')
2
-
3
1
  module.exports = {
4
2
  asyncForEach: async (array, callback) => {
5
3
  for (let index = 0; index < array.length; index++) {
@@ -14,10 +12,6 @@ module.exports = {
14
12
  throw new Error(`could not load ${module}`)
15
13
  }
16
14
  },
17
- clearConsole: () => {
18
- const blank = '\n'.repeat(process.stdout.rows)
19
- console.log(blank)
20
- readline.cursorTo(process.stdout, 0, 0)
21
- readline.clearScreenDown(process.stdout)
22
- }
15
+ // https://github.com/lukeed/console-clear
16
+ clearConsole: () => process.stdout.write('\x1B[H\x1B[2J')
23
17
  }
@@ -1,7 +1,83 @@
1
- <div style="background-image: url('https://example.com/foo/bar.jpg')">
2
- <img src="https://example.com/logo.png" srcset="https://example.com/assets/logo.png 1x, https://example.com/assets/logo@2x.png 2x">
3
- </div>
1
+ <html>
2
+ <head>
3
+ <style>.test {
4
+ background-image: url('https://example.com/image.jpg');
5
+ background: url('https://example.com/image.jpg');
6
+ background-image: url('https://preserve.me/image.jpg');
7
+ background: url('https://preserve.me/image.jpg');
8
+ }
4
9
 
5
- <div style="background: url(https://example.com/foo/bar.jpg)">
6
- <img background="https://example.com/example.jpg" srcset="https://example.com/example.jpg 1x, https://example.com/example@2x.jpg 2x">
7
- </div>
10
+ .test-2 {
11
+ background-image: url("https://example.com/image.jpg");
12
+ background: url("https://example.com/image.jpg");
13
+ background-image: url("https://preserve.me/image.jpg");
14
+ background: url("https://preserve.me/image.jpg");
15
+ }
16
+
17
+ .test-3 {
18
+ background-image: url(https://example.com/image.jpg);
19
+ background: url(https://example.com/image.jpg);
20
+ background-image: url(https://preserve.me/image.jpg);
21
+ background: url(https://preserve.me/image.jpg);
22
+ }</style>
23
+ </head>
24
+
25
+ <body>
26
+ <img src="https://example.com/test.jpg">
27
+ <img src="https://example.com/test.jpg">
28
+
29
+ <img src="https://example.com/image1.jpg" srcset="https://example.com/image1-HD.jpg 2x, https://example.com/image1-phone.jpg 100w">
30
+
31
+ <img src="https://example.com/image2.jpg" srcset="https://example.com/image2-HD.jpg 2x, https://example.com/image2-phone.jpg 100w">
32
+
33
+ <picture>
34
+ <source media="(max-width: 799px)" srcset="https://example.com/elva-480w-close-portrait.jpg">
35
+ <source media="(min-width: 800px)" srcset="https://example.com/elva-800w.jpg">
36
+ <img src="https://example.com/elva-800w.jpg" alt="...">
37
+ </picture>
38
+
39
+ <video width="250" poster="https://example.com/flower.jpg">
40
+ <source src="https://example.com/media/flower.webm" type="video/webm">
41
+ <source src="https://example.tv/media/flower.mp4" type="video/mp4">
42
+ <track default="" kind="captions" srclang="en" src="https://example.com/media/tracks/friday.vtt">
43
+ </video>
44
+
45
+ <audio src="https://example.com/media/sample.mp3">
46
+ Fallback content
47
+ </audio>
48
+
49
+ <embed type="video/webm" src="https://example.com/media/flower.mp4" width="250" height="200">
50
+
51
+ <iframe width="300" height="200" src="https://example.com/embed.html"></iframe>
52
+
53
+ <input type="image" src="https://example.com/image.jpg" alt="">
54
+
55
+ <script src="https://example.com/javascript.js"></script>
56
+
57
+ <div>
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;">
61
+ <v:textbox inset="0,0,0,0"><div><![endif]-->
62
+ <div>test</div>
63
+ <!--[if mso]></div></v:textbox></v:rect><![endif]-->
64
+ </div>
65
+
66
+ <table>
67
+ <tr>
68
+ <td background="https://example.com/image.png" bgcolor="#7bceeb" width="120" height="92" valign="top">
69
+ <!--[if gte mso 9]>
70
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
71
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
72
+ <v:textbox inset="0,0,0,0">
73
+ <![endif]-->
74
+ <div>test</div>
75
+ <!--[if gte mso 9]>
76
+ </v:textbox>
77
+ </v:rect>
78
+ <![endif]-->
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ </body>
83
+ </html>
@@ -0,0 +1,19 @@
1
+ <style>.inline { display: inline !important
2
+ } .table { display: table !important
3
+ } .contents { display: contents !important
4
+ } .hidden { display: none !important
5
+ } .transform { 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
6
+ } div { width: 100%
7
+ } @media (min-width: 640px) { div { max-width: 640px
8
+ }
9
+ } @media (min-width: 768px) { div { max-width: 768px
10
+ }
11
+ } @media (min-width: 1024px) { div { max-width: 1024px
12
+ }
13
+ } @media (min-width: 1280px) { div { max-width: 1280px
14
+ }
15
+ } @media (min-width: 1536px) { div { max-width: 1536px
16
+ }
17
+ } div { display: none
18
+ }
19
+ </style>
@@ -0,0 +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,9 +1,9 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>test></title>
5
- </head>
6
- <body>
7
- <div>test</div>
8
- </body>
9
- </html>
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>test></title>
5
+ </head>
6
+ <body>
7
+ <div>test</div>
8
+ </body>
9
+ </html>
@@ -1,7 +1,85 @@
1
- <div style="background-image: url('foo/bar.jpg')">
2
- <img src="logo.png" srcset="assets/logo.png 1x, assets/logo@2x.png 2x">
3
- </div>
1
+ <html>
2
+ <head>
3
+ <style>
4
+ .test {
5
+ background-image: url('image.jpg');
6
+ background: url('image.jpg');
7
+ background-image: url('https://preserve.me/image.jpg');
8
+ background: url('https://preserve.me/image.jpg');
9
+ }
4
10
 
5
- <div style="background: url(foo/bar.jpg)">
6
- <img background="example.jpg" srcset="example.jpg 1x, example@2x.jpg 2x">
7
- </div>
11
+ .test-2 {
12
+ background-image: url("image.jpg");
13
+ background: url("image.jpg");
14
+ background-image: url("https://preserve.me/image.jpg");
15
+ background: url("https://preserve.me/image.jpg");
16
+ }
17
+
18
+ .test-3 {
19
+ background-image: url(image.jpg);
20
+ background: url(image.jpg);
21
+ background-image: url(https://preserve.me/image.jpg);
22
+ background: url(https://preserve.me/image.jpg);
23
+ }
24
+ </style>
25
+ </head>
26
+
27
+ <body>
28
+ <img src="test.jpg">
29
+ <img src="https://example.com/test.jpg">
30
+
31
+ <img src="image1.jpg" srcset="image1-HD.jpg 2x,image1-phone.jpg 100w">
32
+
33
+ <img src="https://example.com/image2.jpg" srcset="https://example.com/image2-HD.jpg 2x, https://example.com/image2-phone.jpg 100w">
34
+
35
+ <picture>
36
+ <source media="(max-width: 799px)" srcset="elva-480w-close-portrait.jpg">
37
+ <source media="(min-width: 800px)" srcset="elva-800w.jpg">
38
+ <img src="elva-800w.jpg" alt="...">
39
+ </picture>
40
+
41
+ <video width="250" poster="flower.jpg">
42
+ <source src="media/flower.webm" type="video/webm">
43
+ <source src="https://example.tv/media/flower.mp4" type="video/mp4">
44
+ <track default kind="captions" srclang="en" src="media/tracks/friday.vtt">
45
+ </video>
46
+
47
+ <audio src="media/sample.mp3">
48
+ Fallback content
49
+ </audio>
50
+
51
+ <embed type="video/webm" src="media/flower.mp4" width="250" height="200">
52
+
53
+ <iframe width="300" height="200" src="embed.html"></iframe>
54
+
55
+ <input type="image" src="image.jpg" alt="">
56
+
57
+ <script src="javascript.js"></script>
58
+
59
+ <div>
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;">
63
+ <v:textbox inset="0,0,0,0"><div><![endif]-->
64
+ <div>test</div>
65
+ <!--[if mso]></div></v:textbox></v:rect><![endif]-->
66
+ </div>
67
+
68
+ <table>
69
+ <tr>
70
+ <td background="image.png" bgcolor="#7bceeb" width="120" height="92" valign="top">
71
+ <!--[if gte mso 9]>
72
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
73
+ <v:fill type="tile" src="image.png" color="#7bceeb" />
74
+ <v:textbox inset="0,0,0,0">
75
+ <![endif]-->
76
+ <div>test</div>
77
+ <!--[if gte mso 9]>
78
+ </v:textbox>
79
+ </v:rect>
80
+ <![endif]-->
81
+ </td>
82
+ </tr>
83
+ </table>
84
+ </body>
85
+ </html>
@@ -0,0 +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>
@@ -0,0 +1 @@
1
+ <div class="hidden"></div>
@@ -1,8 +1,21 @@
1
1
  const test = require('ava')
2
+ const ora = require('ora')
2
3
  const Tailwind = require('../src/generators/tailwindcss')
3
4
 
5
+ test('throws on compile error', async t => {
6
+ await t.throwsAsync(async () => {
7
+ const spinner = ora('Compiling Tailwind CSS...').start()
8
+ await Tailwind.compile('.test {@apply inexistent;}', '<div class="test">Test</a>', {}, {}, spinner)
9
+ }, {instanceOf: Error, message: 'Tailwind CSS compilation failed'})
10
+ })
11
+
4
12
  test('uses Tailwind defaults if no config specified', async t => {
5
- const css = await Tailwind.compile('@tailwind utilities', '<p class="xl:z-0"></p>', {}, {env: 'production'})
13
+ const css = await Tailwind.compile(
14
+ '@tailwind utilities;',
15
+ '<p class="xl:z-0"></p>',
16
+ {},
17
+ {env: 'production'}
18
+ )
6
19
 
7
20
  t.not(css, undefined)
8
21
  t.true(css.includes('.xl\\:z-0'))
@@ -25,36 +38,67 @@ test('uses CSS file provided in environment config', async t => {
25
38
  t.true(css.includes('.foo'))
26
39
  })
27
40
 
28
- test('uses purgeCSS options provided in the maizzle config', async t => {
29
- const arrayConfig = {
30
- purgeCSS: {
31
- safelist: ['z-10'],
32
- blocklist: ['text-center']
41
+ test('works with custom `content` sources', async t => {
42
+ const css = await Tailwind.compile(
43
+ '@tailwind utilities;',
44
+ '<div class="hidden"></div>',
45
+ {
46
+ content: ['./test/stubs/tailwind/*.*']
33
47
  }
34
- }
48
+ )
49
+
50
+ t.true(css.includes('.hidden'))
51
+ })
35
52
 
36
- const objectConfig = {
37
- purgeCSS: {
38
- safelist: {
39
- standard: ['z-10']
40
- },
41
- blocklist: ['text-center']
53
+ test('works with custom `files` sources', async t => {
54
+ const css = await Tailwind.compile(
55
+ '@tailwind utilities;',
56
+ '<div></div>',
57
+ {
58
+ content: {
59
+ files: ['./test/stubs/tailwind/*.*']
60
+ }
42
61
  }
43
- }
62
+ )
44
63
 
45
- const css1 = await Tailwind.compile('@tailwind utilities', '<div class="z-0 text-center"></div>', {}, arrayConfig)
46
- const css2 = await Tailwind.compile('@tailwind utilities', '<div class="z-0 text-center"></div>', {}, objectConfig)
64
+ t.true(css.includes('.hidden'))
65
+ })
47
66
 
48
- t.true(css1.includes('.z-0'))
49
- t.true(css1.includes('.z-10'))
50
- t.false(css1.includes('.text-center'))
67
+ test('uses maizzle template path as content source', async t => {
68
+ const css = await Tailwind.compile(
69
+ '@tailwind utilities;',
70
+ '<div></div>',
71
+ {},
72
+ {
73
+ build: {
74
+ templates: {
75
+ source: './test/stubs/tailwind'
76
+ }
77
+ }
78
+ }
79
+ )
80
+
81
+ t.true(css.includes('.hidden'))
82
+ })
83
+
84
+ test('uses maizzle template path as content source (single file)', async t => {
85
+ const css = await Tailwind.compile(
86
+ '@tailwind utilities;',
87
+ '<div></div>',
88
+ {},
89
+ {
90
+ build: {
91
+ templates: {
92
+ source: './test/stubs/tailwind/preserve.html'
93
+ }
94
+ }
95
+ }
96
+ )
51
97
 
52
- t.true(css2.includes('.z-0'))
53
- t.true(css2.includes('.z-10'))
54
- t.false(css2.includes('.text-center'))
98
+ t.true(css.includes('.hidden'))
55
99
  })
56
100
 
57
- test('uses postcss plugins from the maizzle config when compiling from string', async t => {
101
+ test('uses custom postcss plugins from the maizzle config', async t => {
58
102
  const maizzleConfig = {
59
103
  env: 'production',
60
104
  build: {
@@ -69,5 +113,5 @@ test('uses postcss plugins from the maizzle config when compiling from string',
69
113
  const css = await Tailwind.compile('.test {transform: scale(0.5)}', '<div class="test">Test</a>', {}, maizzleConfig)
70
114
 
71
115
  t.not(css, undefined)
72
- t.is(css.trim(), '/* purgecss start ignore */\n\n.test {\n -webkit-transform: scale(0.5);\n -ms-transform: scale(0.5);\n transform: scale(0.5)\n}\n\n/* purgecss end ignore */')
116
+ t.is(css.trim(), '.test {-webkit-transform: scale(0.5);transform: scale(0.5)}')
73
117
  })