@maizzle/framework 4.0.0-alpha.9 → 4.0.0
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/media/logo-dark.svg +1 -0
- package/.github/media/logo-light.svg +1 -0
- package/.github/workflows/nodejs.yml +1 -1
- package/README.md +42 -35
- package/package.json +91 -91
- package/src/generators/output/to-string.js +67 -71
- package/src/transformers/index.js +63 -60
- package/src/transformers/inlineCss.js +0 -13
- package/src/transformers/prettify.js +27 -29
- package/src/transformers/shorthandInlineCSS.js +19 -0
- package/test/expected/posthtml/component.html +1 -1
- package/test/expected/transformers/atimport-in-style.html +12 -13
- 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/test-config.js +19 -19
- package/test/test-postcss.js +8 -8
- package/test/test-posthtml.js +72 -66
- package/test/test-tailwindcss.js +117 -117
- package/test/test-todisk.js +511 -511
- package/test/test-transformers.js +510 -490
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><path d="M322.869 65.213c0-13.843-11.222-25.065-25.065-25.065-13.844 0-25.066 11.222-25.066 25.065v133.683c0 13.843 11.222 25.065 25.066 25.065 13.843 0 25.065-11.222 25.065-25.065V65.213Z" stroke="url(#a)" stroke-width="5" stroke-miterlimit="10"/><path d="M218.012 65.213c0-13.843-11.222-25.065-25.066-25.065-13.843 0-25.065 11.222-25.065 25.065v133.683c0 13.843 11.222 25.065 25.065 25.065 13.844 0 25.066-11.222 25.066-25.065V65.213Z" stroke="url(#b)" stroke-width="5" stroke-miterlimit="10"/><path d="M317.555 80.632c8.53-10.903 6.607-26.656-4.296-35.186-10.903-8.53-26.656-6.608-35.187 4.295L173.403 183.519c-8.531 10.903-6.607 26.657 4.295 35.187 10.903 8.53 26.657 6.607 35.187-4.295l104.67-133.779Z" stroke="url(#c)" stroke-width="5" stroke-miterlimit="10"/><path d="M212.597 80.636c8.53-10.902 6.607-26.656-4.295-35.186-10.903-8.53-26.657-6.608-35.187 4.295L68.445 183.523c-8.53 10.903-6.607 26.657 4.296 35.187 10.902 8.53 26.656 6.607 35.186-4.295l104.67-133.779Z" stroke="url(#d)" stroke-width="5" stroke-miterlimit="10"/><rect x="168" y="234" width="158" height="36" rx="18" fill="#4F46E5"/><path d="M199.116 259v-13.091h7.849v1.406h-6.264v4.424h5.676v1.406h-5.676V259h-1.585Zm10.254 0v-9.818h1.457v1.483h.103c.179-.486.502-.88.971-1.183a2.865 2.865 0 0 1 1.585-.454c.111 0 .25.003.416.007.166.004.292.01.377.019v1.534a4.15 4.15 0 0 0-.352-.057 3.432 3.432 0 0 0-.568-.045c-.478 0-.904.1-1.279.3a2.264 2.264 0 0 0-.882.818 2.21 2.21 0 0 0-.32 1.183V259h-1.508Zm9.586.23a3.991 3.991 0 0 1-1.693-.351 2.909 2.909 0 0 1-1.209-1.03c-.298-.451-.447-.997-.447-1.636 0-.562.111-1.018.332-1.368.222-.354.518-.631.889-.831.371-.2.78-.349 1.227-.447.452-.103.906-.183 1.362-.243.596-.077 1.08-.134 1.451-.173.375-.042.647-.113.818-.211.175-.098.262-.268.262-.511v-.051c0-.631-.173-1.121-.518-1.47-.341-.35-.859-.524-1.553-.524-.72 0-1.285.157-1.694.473-.409.315-.697.652-.863 1.009l-1.432-.511c.256-.596.597-1.061 1.023-1.393.43-.337.899-.571 1.406-.703a5.815 5.815 0 0 1 1.509-.205c.315 0 .677.038 1.086.115.414.072.812.224 1.196.454.387.23.709.577.965 1.042.256.464.383 1.086.383 1.866V259h-1.508v-1.33h-.077c-.102.214-.273.442-.511.684-.239.243-.556.45-.953.62-.396.171-.88.256-1.451.256Zm.231-1.355c.596 0 1.099-.117 1.508-.352a2.39 2.39 0 0 0 1.253-2.077v-1.381c-.064.077-.205.147-.422.211-.213.06-.46.113-.741.16a31.625 31.625 0 0 1-1.445.192 5.737 5.737 0 0 0-1.099.249c-.337.111-.61.279-.819.505-.204.222-.306.524-.306.908 0 .524.193.92.581 1.189.392.264.889.396 1.49.396ZM226.21 259v-9.818h1.457v1.534h.128c.205-.524.535-.931.991-1.221.456-.294 1.003-.441 1.643-.441.647 0 1.186.147 1.617.441.434.29.773.697 1.016 1.221h.102c.252-.507.629-.91 1.132-1.208.503-.303 1.106-.454 1.809-.454.878 0 1.596.275 2.154.825.558.545.837 1.395.837 2.55V259h-1.508v-6.571c0-.724-.199-1.242-.595-1.553a2.2 2.2 0 0 0-1.4-.467c-.69 0-1.225.209-1.604.627-.379.413-.569.937-.569 1.572V259h-1.534v-6.724c0-.559-.181-1.008-.543-1.349-.363-.345-.829-.518-1.4-.518-.392 0-.759.104-1.1.313a2.373 2.373 0 0 0-.818.87c-.204.366-.307.79-.307 1.272V259h-1.508Zm19.761.205c-.946 0-1.762-.209-2.448-.627a4.207 4.207 0 0 1-1.579-1.764c-.367-.759-.55-1.641-.55-2.646 0-1.006.183-1.892.55-2.659.371-.772.886-1.373 1.547-1.803.664-.435 1.44-.652 2.326-.652.512 0 1.017.085 1.515.256.499.17.953.447 1.362.831.409.379.735.882.978 1.508.243.627.364 1.398.364 2.314v.639h-7.568v-1.304h6.034c0-.554-.111-1.048-.332-1.483a2.517 2.517 0 0 0-.934-1.029c-.4-.251-.873-.377-1.419-.377-.6 0-1.12.149-1.559.448a2.945 2.945 0 0 0-1.004 1.15c-.234.473-.351.98-.351 1.521v.87c0 .741.127 1.37.383 1.885.26.512.62.902 1.08 1.17.461.264.995.396 1.605.396.396 0 .754-.055 1.074-.166a2.29 2.29 0 0 0 .837-.511 2.33 2.33 0 0 0 .543-.857l1.458.409a3.226 3.226 0 0 1-.774 1.304 3.764 3.764 0 0 1-1.342.87c-.533.204-1.131.307-1.796.307Zm8.584-.205-2.991-9.818h1.585l2.122 7.517h.102l2.097-7.517h1.611l2.071 7.491h.102l2.122-7.491h1.586L261.97 259h-1.483l-2.148-7.543h-.153L256.038 259h-1.483Zm16.056.205c-.887 0-1.665-.211-2.334-.633-.664-.422-1.184-1.012-1.559-1.771-.371-.758-.556-1.645-.556-2.659 0-1.023.185-1.915.556-2.678.375-.763.895-1.355 1.559-1.777.669-.422 1.447-.633 2.334-.633.886 0 1.661.211 2.326.633.669.422 1.189 1.014 1.56 1.777.375.763.562 1.655.562 2.678 0 1.014-.187 1.901-.562 2.659-.371.759-.891 1.349-1.56 1.771-.665.422-1.44.633-2.326.633Zm0-1.356c.673 0 1.227-.172 1.661-.517a3.05 3.05 0 0 0 .966-1.362 5.23 5.23 0 0 0 .313-1.828 5.28 5.28 0 0 0-.313-1.834 3.096 3.096 0 0 0-.966-1.375c-.434-.349-.988-.524-1.661-.524-.674 0-1.228.175-1.662.524-.435.35-.757.808-.966 1.375a5.28 5.28 0 0 0-.313 1.834c0 .656.105 1.266.313 1.828a3.05 3.05 0 0 0 .966 1.362c.434.345.988.517 1.662.517Zm6.751 1.151v-9.818h1.458v1.483h.102c.179-.486.503-.88.971-1.183a2.868 2.868 0 0 1 1.586-.454c.11 0 .249.003.415.007.166.004.292.01.377.019v1.534a4.176 4.176 0 0 0-.351-.057 3.445 3.445 0 0 0-.569-.045c-.478 0-.904.1-1.279.3-.37.196-.664.469-.882.818a2.21 2.21 0 0 0-.319 1.183V259h-1.509Zm8.104-3.58-.026-1.866h.307l4.295-4.372h1.867l-4.577 4.628h-.128l-1.738 1.61Zm-1.407 3.58v-13.091h1.509V259h-1.509Zm6.239 0-3.835-4.858 1.074-1.048 4.679 5.906h-1.918Z" fill="#fff"/><defs><linearGradient id="a" x1="297.804" y1="40.148" x2="297.804" y2="223.961" gradientUnits="userSpaceOnUse"><stop stop-color="#4F46E5"/><stop offset="1" stop-color="#9C96FF"/></linearGradient><linearGradient id="b" x1="192.946" y1="40.148" x2="192.946" y2="223.961" gradientUnits="userSpaceOnUse"><stop stop-color="#4F46E5"/><stop offset="1" stop-color="#9C96FF"/></linearGradient><linearGradient id="c" x1="313.259" y1="45.446" x2="177.698" y2="218.706" gradientUnits="userSpaceOnUse"><stop stop-color="#4F46E5"/><stop offset="1" stop-color="#9C96FF"/></linearGradient><linearGradient id="d" x1="208.302" y1="45.45" x2="72.741" y2="218.71" gradientUnits="userSpaceOnUse"><stop stop-color="#4F46E5"/><stop offset="1" stop-color="#9C96FF"/></linearGradient></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><path d="M322.869 65.213c0-13.843-11.222-25.065-25.065-25.065-13.844 0-25.066 11.222-25.066 25.065v133.683c0 13.843 11.222 25.065 25.066 25.065 13.843 0 25.065-11.222 25.065-25.065V65.213ZM218.012 65.213c0-13.843-11.222-25.065-25.066-25.065-13.843 0-25.065 11.222-25.065 25.065v133.683c0 13.843 11.222 25.065 25.065 25.065 13.844 0 25.066-11.222 25.066-25.065V65.213Z" stroke="#4F46E5" stroke-width="5" stroke-miterlimit="10"/><path d="M317.555 80.632c8.53-10.903 6.607-26.656-4.296-35.186-10.903-8.53-26.656-6.608-35.187 4.295L173.403 183.519c-8.531 10.903-6.607 26.657 4.295 35.187 10.903 8.53 26.657 6.607 35.187-4.295l104.67-133.779ZM212.597 80.636c8.53-10.902 6.607-26.656-4.295-35.186-10.903-8.53-26.657-6.608-35.187 4.295L68.445 183.523c-8.53 10.903-6.607 26.657 4.296 35.187 10.902 8.53 26.656 6.607 35.186-4.295l104.67-133.779Z" stroke="#4F46E5" stroke-width="5" stroke-miterlimit="10"/><rect x="165" y="234" width="158" height="36" rx="18" fill="#4F46E5"/><path d="M197.116 259v-13.091h7.849v1.406h-6.264v4.424h5.676v1.406h-5.676V259h-1.585Zm10.254 0v-9.818h1.457v1.483h.103c.179-.486.502-.88.971-1.183a2.865 2.865 0 0 1 1.585-.454c.111 0 .25.003.416.007.166.004.292.01.377.019v1.534a4.15 4.15 0 0 0-.352-.057 3.432 3.432 0 0 0-.568-.045c-.478 0-.904.1-1.279.3a2.264 2.264 0 0 0-.882.818 2.21 2.21 0 0 0-.32 1.183V259h-1.508Zm9.586.23a3.991 3.991 0 0 1-1.693-.351 2.909 2.909 0 0 1-1.209-1.03c-.298-.451-.447-.997-.447-1.636 0-.562.111-1.018.332-1.368.222-.354.518-.631.889-.831.371-.2.78-.349 1.227-.447.452-.103.906-.183 1.362-.243.596-.077 1.08-.134 1.451-.173.375-.042.647-.113.818-.211.175-.098.262-.268.262-.511v-.051c0-.631-.173-1.121-.518-1.47-.341-.35-.859-.524-1.553-.524-.72 0-1.285.157-1.694.473-.409.315-.697.652-.863 1.009l-1.432-.511c.256-.596.597-1.061 1.023-1.393.43-.337.899-.571 1.406-.703a5.815 5.815 0 0 1 1.509-.205c.315 0 .677.038 1.086.115.414.072.812.224 1.196.454.387.23.709.577.965 1.042.256.464.383 1.086.383 1.866V259h-1.508v-1.33h-.077c-.102.214-.273.442-.511.684-.239.243-.556.45-.953.62-.396.171-.88.256-1.451.256Zm.231-1.355c.596 0 1.099-.117 1.508-.352a2.39 2.39 0 0 0 1.253-2.077v-1.381c-.064.077-.205.147-.422.211-.213.06-.46.113-.741.16a31.625 31.625 0 0 1-1.445.192 5.737 5.737 0 0 0-1.099.249c-.337.111-.61.279-.819.505-.204.222-.306.524-.306.908 0 .524.193.92.581 1.189.392.264.889.396 1.49.396ZM224.21 259v-9.818h1.457v1.534h.128c.205-.524.535-.931.991-1.221.456-.294 1.003-.441 1.643-.441.647 0 1.186.147 1.617.441.434.29.773.697 1.016 1.221h.102c.252-.507.629-.91 1.132-1.208.503-.303 1.106-.454 1.809-.454.878 0 1.596.275 2.154.825.558.545.837 1.395.837 2.55V259h-1.508v-6.571c0-.724-.199-1.242-.595-1.553a2.2 2.2 0 0 0-1.4-.467c-.69 0-1.225.209-1.604.627-.379.413-.569.937-.569 1.572V259h-1.534v-6.724c0-.559-.181-1.008-.543-1.349-.363-.345-.829-.518-1.4-.518-.392 0-.759.104-1.1.313a2.373 2.373 0 0 0-.818.87c-.204.366-.307.79-.307 1.272V259h-1.508Zm19.761.205c-.946 0-1.762-.209-2.448-.627a4.207 4.207 0 0 1-1.579-1.764c-.367-.759-.55-1.641-.55-2.646 0-1.006.183-1.892.55-2.659.371-.772.886-1.373 1.547-1.803.664-.435 1.44-.652 2.326-.652.512 0 1.017.085 1.515.256.499.17.953.447 1.362.831.409.379.735.882.978 1.508.243.627.364 1.398.364 2.314v.639h-7.568v-1.304h6.034c0-.554-.111-1.048-.332-1.483a2.517 2.517 0 0 0-.934-1.029c-.4-.251-.873-.377-1.419-.377-.6 0-1.12.149-1.559.448a2.945 2.945 0 0 0-1.004 1.15c-.234.473-.351.98-.351 1.521v.87c0 .741.127 1.37.383 1.885.26.512.62.902 1.08 1.17.461.264.995.396 1.605.396.396 0 .754-.055 1.074-.166a2.29 2.29 0 0 0 .837-.511 2.33 2.33 0 0 0 .543-.857l1.458.409a3.226 3.226 0 0 1-.774 1.304 3.764 3.764 0 0 1-1.342.87c-.533.204-1.131.307-1.796.307Zm8.584-.205-2.991-9.818h1.585l2.122 7.517h.102l2.097-7.517h1.611l2.071 7.491h.102l2.122-7.491h1.586L259.97 259h-1.483l-2.148-7.543h-.153L254.038 259h-1.483Zm16.056.205c-.887 0-1.665-.211-2.334-.633-.664-.422-1.184-1.012-1.559-1.771-.371-.758-.556-1.645-.556-2.659 0-1.023.185-1.915.556-2.678.375-.763.895-1.355 1.559-1.777.669-.422 1.447-.633 2.334-.633.886 0 1.661.211 2.326.633.669.422 1.189 1.014 1.56 1.777.375.763.562 1.655.562 2.678 0 1.014-.187 1.901-.562 2.659-.371.759-.891 1.349-1.56 1.771-.665.422-1.44.633-2.326.633Zm0-1.356c.673 0 1.227-.172 1.661-.517a3.05 3.05 0 0 0 .966-1.362 5.23 5.23 0 0 0 .313-1.828 5.28 5.28 0 0 0-.313-1.834 3.096 3.096 0 0 0-.966-1.375c-.434-.349-.988-.524-1.661-.524-.674 0-1.228.175-1.662.524-.435.35-.757.808-.966 1.375a5.28 5.28 0 0 0-.313 1.834c0 .656.105 1.266.313 1.828a3.05 3.05 0 0 0 .966 1.362c.434.345.988.517 1.662.517Zm6.751 1.151v-9.818h1.458v1.483h.102c.179-.486.503-.88.971-1.183a2.868 2.868 0 0 1 1.586-.454c.11 0 .249.003.415.007.166.004.292.01.377.019v1.534a4.176 4.176 0 0 0-.351-.057 3.445 3.445 0 0 0-.569-.045c-.478 0-.904.1-1.279.3-.37.196-.664.469-.882.818a2.21 2.21 0 0 0-.319 1.183V259h-1.509Zm8.104-3.58-.026-1.866h.307l4.295-4.372h1.867l-4.577 4.628h-.128l-1.738 1.61Zm-1.407 3.58v-13.091h1.509V259h-1.509Zm6.239 0-3.835-4.858 1.074-1.048 4.679 5.906h-1.918Z" fill="#fff"/></svg>
|
package/README.md
CHANGED
|
@@ -1,35 +1,42 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<p
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
[
|
|
34
|
-
|
|
35
|
-
[
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<a href="https://maizzle.com/#gh-light-mode-only" target="_blank">
|
|
4
|
+
<img src="./.github/media/logo-light.svg" alt="Maizzle" width="300">
|
|
5
|
+
</a>
|
|
6
|
+
<a href="https://maizzle.com/#gh-dark-mode-only" target="_blank">
|
|
7
|
+
<img src="./.github/media/logo-dark.svg" alt="Maizzle" width="300">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
<p>Quickly build HTML emails with utility-first CSS</p>
|
|
11
|
+
<div>
|
|
12
|
+
|
|
13
|
+
[![Version][npm-version-shield]][npm]
|
|
14
|
+
[![Build][github-ci-shield]][github-ci]
|
|
15
|
+
[![Downloads][npm-stats-shield]][npm-stats]
|
|
16
|
+
[![License][license-shield]][license]
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
## About
|
|
22
|
+
|
|
23
|
+
> **Note:** This repository contains the core code of the Maizzle framework. If you want to build HTML emails using Maizzle, visit the [Starter repository](https://github.com/maizzle/maizzle).
|
|
24
|
+
|
|
25
|
+
Maizzle is a framework that helps you quickly build HTML emails with [Tailwind CSS](https://tailwindcss.com/).
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
Maizzle documentation is available at https://maizzle.com
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
The Maizzle framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
34
|
+
|
|
35
|
+
[npm]: https://www.npmjs.com/package/@maizzle/framework
|
|
36
|
+
[npm-stats]: https://npm-stat.com/charts.html?package=%40maizzle%2Fframework&from=2019-03-27
|
|
37
|
+
[npm-version-shield]: https://img.shields.io/npm/v/@maizzle/framework.svg?style=flat-square
|
|
38
|
+
[npm-stats-shield]: https://img.shields.io/npm/dt/@maizzle/framework.svg?style=flat-square&color=4f46e5
|
|
39
|
+
[github-ci]: https://github.com/maizzle/framework/actions
|
|
40
|
+
[github-ci-shield]: https://img.shields.io/github/workflow/status/maizzle/framework/Node.js%20CI?style=flat-square
|
|
41
|
+
[license]: ./LICENSE
|
|
42
|
+
[license-shield]: https://img.shields.io/npm/l/@maizzle/framework.svg?style=flat-square&color=0e9f6e
|
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@maizzle/framework",
|
|
3
|
-
"version": "4.0.0
|
|
4
|
-
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "src/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"maizzle": "bin/maizzle"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/maizzle/framework.git"
|
|
13
|
-
},
|
|
14
|
-
"bugs": "https://github.com/maizzle/framework/issues",
|
|
15
|
-
"homepage": "https://maizzle.com",
|
|
16
|
-
"author": "Cosmin Popovici (https://github.com/cossssmin)",
|
|
17
|
-
"keywords": [
|
|
18
|
-
"maizzle",
|
|
19
|
-
"tailwindcss",
|
|
20
|
-
"responsive-email",
|
|
21
|
-
"email-framework",
|
|
22
|
-
"email-template",
|
|
23
|
-
"email-marketing",
|
|
24
|
-
"email-campaigns",
|
|
25
|
-
"email-newsletter",
|
|
26
|
-
"email-boilerplate",
|
|
27
|
-
"html-emails"
|
|
28
|
-
],
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"test": "c8 ava -s",
|
|
34
|
-
"pretest": "xo",
|
|
35
|
-
"style": "xo",
|
|
36
|
-
"release": "np"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@maizzle/cli": "^1.
|
|
40
|
-
"autoprefixer": "^10.4.0",
|
|
41
|
-
"browser-sync": "^2.26.13",
|
|
42
|
-
"color-shorthand-hex-to-six-digit": "^3.0.2",
|
|
43
|
-
"email-comb": "^5.2.0",
|
|
44
|
-
"front-matter": "^4.0.0",
|
|
45
|
-
"fs-extra": "^10.0.0",
|
|
46
|
-
"glob-promise": "^4.1.0",
|
|
47
|
-
"html-crush": "^4.0.0",
|
|
48
|
-
"is-url-superb": "^5.0.0",
|
|
49
|
-
"juice": "^8.0.0",
|
|
50
|
-
"lodash": "^4.17.20",
|
|
51
|
-
"ora": "^5.1.0",
|
|
52
|
-
"postcss": "^8.4.4",
|
|
53
|
-
"postcss-import": "^14.0.0",
|
|
54
|
-
"postcss-merge-longhand": "^5.0.1",
|
|
55
|
-
"posthtml": "^0.16.6",
|
|
56
|
-
"posthtml-attrs-parser": "^0.1.1",
|
|
57
|
-
"posthtml-base-url": "^1.0.1",
|
|
58
|
-
"posthtml-content": "^0.1.0",
|
|
59
|
-
"posthtml-expressions": "^1.8.1",
|
|
60
|
-
"posthtml-extend": "^0.6.0",
|
|
61
|
-
"posthtml-extra-attributes": "^1.0.0",
|
|
62
|
-
"posthtml-fetch": "^2.2.0",
|
|
63
|
-
"posthtml-markdownit": "^1.3.0",
|
|
64
|
-
"posthtml-match-helper": "^1.0.3",
|
|
65
|
-
"posthtml-modules": "^0.9.0",
|
|
66
|
-
"posthtml-mso": "^1.0.4",
|
|
67
|
-
"posthtml-postcss-merge-longhand": "^1.0.2",
|
|
68
|
-
"posthtml-remove-attributes": "^1.0.0",
|
|
69
|
-
"posthtml-safe-class-names": "^1.0.8",
|
|
70
|
-
"posthtml-url-parameters": "^1.0.4",
|
|
71
|
-
"pretty": "^2.0.0",
|
|
72
|
-
"prevent-widows": "^1.0.2",
|
|
73
|
-
"query-string": "^7.1.0",
|
|
74
|
-
"string-strip-html": "^8.2.0",
|
|
75
|
-
"tailwindcss": "^3.0.0"
|
|
76
|
-
},
|
|
77
|
-
"devDependencies": {
|
|
78
|
-
"ava": "^4.0.1",
|
|
79
|
-
"c8": "^7.11.0",
|
|
80
|
-
"np": "*",
|
|
81
|
-
"xo": "0.39.1"
|
|
82
|
-
},
|
|
83
|
-
"engines": {
|
|
84
|
-
"node": ">=14.0.0"
|
|
85
|
-
},
|
|
86
|
-
"ava": {
|
|
87
|
-
"files": [
|
|
88
|
-
"test/**/test*.js"
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@maizzle/framework",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"maizzle": "bin/maizzle"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/maizzle/framework.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/maizzle/framework/issues",
|
|
15
|
+
"homepage": "https://maizzle.com",
|
|
16
|
+
"author": "Cosmin Popovici (https://github.com/cossssmin)",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"maizzle",
|
|
19
|
+
"tailwindcss",
|
|
20
|
+
"responsive-email",
|
|
21
|
+
"email-framework",
|
|
22
|
+
"email-template",
|
|
23
|
+
"email-marketing",
|
|
24
|
+
"email-campaigns",
|
|
25
|
+
"email-newsletter",
|
|
26
|
+
"email-boilerplate",
|
|
27
|
+
"html-emails"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "c8 ava -s",
|
|
34
|
+
"pretest": "xo",
|
|
35
|
+
"style": "xo",
|
|
36
|
+
"release": "np"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@maizzle/cli": "^1.5.0",
|
|
40
|
+
"autoprefixer": "^10.4.0",
|
|
41
|
+
"browser-sync": "^2.26.13",
|
|
42
|
+
"color-shorthand-hex-to-six-digit": "^3.0.2",
|
|
43
|
+
"email-comb": "^5.2.0",
|
|
44
|
+
"front-matter": "^4.0.0",
|
|
45
|
+
"fs-extra": "^10.0.0",
|
|
46
|
+
"glob-promise": "^4.1.0",
|
|
47
|
+
"html-crush": "^4.0.0",
|
|
48
|
+
"is-url-superb": "^5.0.0",
|
|
49
|
+
"juice": "^8.0.0",
|
|
50
|
+
"lodash": "^4.17.20",
|
|
51
|
+
"ora": "^5.1.0",
|
|
52
|
+
"postcss": "^8.4.4",
|
|
53
|
+
"postcss-import": "^14.0.0",
|
|
54
|
+
"postcss-merge-longhand": "^5.0.1",
|
|
55
|
+
"posthtml": "^0.16.6",
|
|
56
|
+
"posthtml-attrs-parser": "^0.1.1",
|
|
57
|
+
"posthtml-base-url": "^1.0.1",
|
|
58
|
+
"posthtml-content": "^0.1.0",
|
|
59
|
+
"posthtml-expressions": "^1.8.1",
|
|
60
|
+
"posthtml-extend": "^0.6.0",
|
|
61
|
+
"posthtml-extra-attributes": "^1.0.0",
|
|
62
|
+
"posthtml-fetch": "^2.2.0",
|
|
63
|
+
"posthtml-markdownit": "^1.3.0",
|
|
64
|
+
"posthtml-match-helper": "^1.0.3",
|
|
65
|
+
"posthtml-modules": "^0.9.0",
|
|
66
|
+
"posthtml-mso": "^1.0.4",
|
|
67
|
+
"posthtml-postcss-merge-longhand": "^1.0.2",
|
|
68
|
+
"posthtml-remove-attributes": "^1.0.0",
|
|
69
|
+
"posthtml-safe-class-names": "^1.0.8",
|
|
70
|
+
"posthtml-url-parameters": "^1.0.4",
|
|
71
|
+
"pretty": "^2.0.0",
|
|
72
|
+
"prevent-widows": "^1.0.2",
|
|
73
|
+
"query-string": "^7.1.0",
|
|
74
|
+
"string-strip-html": "^8.2.0",
|
|
75
|
+
"tailwindcss": "^3.0.0"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"ava": "^4.0.1",
|
|
79
|
+
"c8": "^7.11.0",
|
|
80
|
+
"np": "*",
|
|
81
|
+
"xo": "0.39.1"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=14.0.0"
|
|
85
|
+
},
|
|
86
|
+
"ava": {
|
|
87
|
+
"files": [
|
|
88
|
+
"test/**/test*.js"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,71 +1,67 @@
|
|
|
1
|
-
const fm = require('front-matter')
|
|
2
|
-
const {get, merge} = require('lodash')
|
|
3
|
-
const posthtml = require('../posthtml')
|
|
4
|
-
const Tailwind = require('../tailwindcss')
|
|
5
|
-
const Transformers = require('../../transformers')
|
|
6
|
-
const posthtmlMSO = require('../../transformers/posthtmlMso')
|
|
7
|
-
const Config = require('../config')
|
|
8
|
-
|
|
9
|
-
module.exports = async (html, options) => {
|
|
10
|
-
process.env.NODE_ENV = get(options, 'maizzle.env', 'local')
|
|
11
|
-
|
|
12
|
-
if (typeof html !== 'string') {
|
|
13
|
-
throw new TypeError(`first argument must be an HTML string, received ${html}`)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (html.length === 0) {
|
|
17
|
-
throw new RangeError('received empty string')
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const fileConfig = await Config.getMerged(process.env.NODE_ENV)
|
|
21
|
-
|
|
22
|
-
let config = merge(fileConfig, get(options, 'maizzle', {}))
|
|
23
|
-
|
|
24
|
-
const tailwindConfig = get(options, 'tailwind.config', {})
|
|
25
|
-
const cssString = get(options, 'tailwind.css', '')
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
html =
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
html = await
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
html = await
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
html,
|
|
69
|
-
config
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
const fm = require('front-matter')
|
|
2
|
+
const {get, merge} = require('lodash')
|
|
3
|
+
const posthtml = require('../posthtml')
|
|
4
|
+
const Tailwind = require('../tailwindcss')
|
|
5
|
+
const Transformers = require('../../transformers')
|
|
6
|
+
const posthtmlMSO = require('../../transformers/posthtmlMso')
|
|
7
|
+
const Config = require('../config')
|
|
8
|
+
|
|
9
|
+
module.exports = async (html, options) => {
|
|
10
|
+
process.env.NODE_ENV = get(options, 'maizzle.env', 'local')
|
|
11
|
+
|
|
12
|
+
if (typeof html !== 'string') {
|
|
13
|
+
throw new TypeError(`first argument must be an HTML string, received ${html}`)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (html.length === 0) {
|
|
17
|
+
throw new RangeError('received empty string')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fileConfig = await Config.getMerged(process.env.NODE_ENV)
|
|
21
|
+
|
|
22
|
+
let config = merge(fileConfig, get(options, 'maizzle', {}))
|
|
23
|
+
|
|
24
|
+
const tailwindConfig = get(options, 'tailwind.config', {})
|
|
25
|
+
const cssString = get(options, 'tailwind.css', '')
|
|
26
|
+
|
|
27
|
+
const {frontmatter} = fm(html)
|
|
28
|
+
|
|
29
|
+
html = `---\n${frontmatter}\n---\n\n${fm(html).body}`
|
|
30
|
+
|
|
31
|
+
config = merge({applyTransformers: true}, config, fm(html).attributes)
|
|
32
|
+
|
|
33
|
+
if (typeof get(options, 'tailwind.compiled') === 'string') {
|
|
34
|
+
config.css = options.tailwind.compiled
|
|
35
|
+
} else {
|
|
36
|
+
config.css = await Tailwind.compile(cssString, html, tailwindConfig, config)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (options && typeof options.beforeRender === 'function') {
|
|
40
|
+
html = await options.beforeRender(html, config)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html = await posthtml(html, config)
|
|
44
|
+
|
|
45
|
+
while (Object.keys(fm(html).attributes).length > 0) {
|
|
46
|
+
html = fm(html).body
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (options && typeof options.afterRender === 'function') {
|
|
50
|
+
html = await options.afterRender(html, config)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (config.applyTransformers) {
|
|
54
|
+
html = await Transformers.process(html, config)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (options && typeof options.afterTransformers === 'function') {
|
|
58
|
+
html = await options.afterTransformers(html, config)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
html = await posthtmlMSO(html, config)
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
html,
|
|
65
|
+
config
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
const inline = require('./inlineCss')
|
|
2
|
-
const minify = require('./minify')
|
|
3
|
-
const filters = require('./filters')
|
|
4
|
-
const markdown = require('./markdown')
|
|
5
|
-
const prettify = require('./prettify')
|
|
6
|
-
const ensureSixHEX = require('./sixHex')
|
|
7
|
-
const
|
|
8
|
-
const addURLParams = require('./urlParameters')
|
|
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
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
html = await
|
|
23
|
-
html = await
|
|
24
|
-
html = await
|
|
25
|
-
html = await
|
|
26
|
-
html = await
|
|
27
|
-
html = await
|
|
28
|
-
html = await
|
|
29
|
-
html = await
|
|
30
|
-
html = await
|
|
31
|
-
html = await
|
|
32
|
-
html = await
|
|
33
|
-
html = await
|
|
34
|
-
html = await
|
|
35
|
-
html = await
|
|
36
|
-
html = await
|
|
37
|
-
html = await
|
|
38
|
-
html = await
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
1
|
+
const inline = require('./inlineCss')
|
|
2
|
+
const minify = require('./minify')
|
|
3
|
+
const filters = require('./filters')
|
|
4
|
+
const markdown = require('./markdown')
|
|
5
|
+
const prettify = require('./prettify')
|
|
6
|
+
const ensureSixHEX = require('./sixHex')
|
|
7
|
+
const applyBaseUrl = require('./baseUrl')
|
|
8
|
+
const addURLParams = require('./urlParameters')
|
|
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 shorthandInlineCSS = require('./shorthandInlineCSS')
|
|
18
|
+
const removeInlinedClasses = require('./removeInlinedSelectors')
|
|
19
|
+
const removeInlineBgColor = require('./removeInlineBackgroundColor')
|
|
20
|
+
|
|
21
|
+
exports.process = async (html, config) => {
|
|
22
|
+
html = await safeClassNames(html, config)
|
|
23
|
+
html = await filters(html, config)
|
|
24
|
+
html = await markdown(html, config)
|
|
25
|
+
html = await preventWidows(html, config)
|
|
26
|
+
html = await attributeToStyle(html, config)
|
|
27
|
+
html = await inline(html, config)
|
|
28
|
+
html = await shorthandInlineCSS(html, config)
|
|
29
|
+
html = await removeInlinedClasses(html, config)
|
|
30
|
+
html = await removeUnusedCSS(html, config)
|
|
31
|
+
html = await removeInlineSizes(html, config)
|
|
32
|
+
html = await removeInlineBgColor(html, config)
|
|
33
|
+
html = await removeAttributes(html, config)
|
|
34
|
+
html = await applyExtraAttributes(html, config)
|
|
35
|
+
html = await applyBaseUrl(html, config)
|
|
36
|
+
html = await addURLParams(html, config)
|
|
37
|
+
html = await ensureSixHEX(html, config)
|
|
38
|
+
html = await prettify(html, config)
|
|
39
|
+
html = await minify(html, config)
|
|
40
|
+
html = await replaceStrings(html, config)
|
|
41
|
+
|
|
42
|
+
return html
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.minify = (html, config) => minify(html, config, true)
|
|
46
|
+
exports.inlineCSS = (html, config) => inline(html, config, true)
|
|
47
|
+
exports.markdown = (html, config) => markdown(html, config, true)
|
|
48
|
+
exports.prettify = (html, config) => prettify(html, config, true)
|
|
49
|
+
exports.ensureSixHEX = (html, config) => ensureSixHEX(html, config)
|
|
50
|
+
exports.withFilters = (html, config) => filters(html, config, true)
|
|
51
|
+
exports.addURLParams = (html, config) => addURLParams(html, config, true)
|
|
52
|
+
exports.preventWidows = (html, config) => preventWidows(html, config, true)
|
|
53
|
+
exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
|
|
54
|
+
exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
|
|
55
|
+
exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
|
|
56
|
+
exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
|
|
57
|
+
exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
|
|
58
|
+
exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
|
|
59
|
+
exports.applyBaseUrl = (html, config) => applyBaseUrl(html, config, true)
|
|
60
|
+
exports.removeInlinedClasses = (html, config) => removeInlinedClasses(html, config)
|
|
61
|
+
exports.shorthandInlineCSS = (html, config) => shorthandInlineCSS(html, config, true)
|
|
62
|
+
exports.removeInlineBgColor = (html, config) => removeInlineBgColor(html, config, true)
|
|
63
|
+
exports.applyExtraAttributes = (html, config) => applyExtraAttributes(html, config, true)
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const juice = require('juice')
|
|
2
|
-
const posthtml = require('posthtml')
|
|
3
2
|
const {get, isObject, isEmpty} = require('lodash')
|
|
4
|
-
const mergeLonghand = require('posthtml-postcss-merge-longhand')
|
|
5
3
|
|
|
6
4
|
module.exports = async (html, config = {}, direct = false) => {
|
|
7
5
|
if (get(config, 'inlineCSS') === false) {
|
|
@@ -32,17 +30,6 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
32
30
|
|
|
33
31
|
html = css ? juice.inlineContent(html, css, {removeStyleTags}) : juice(html, {removeStyleTags})
|
|
34
32
|
|
|
35
|
-
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
36
|
-
const mergeLonghandConfig = get(options, 'mergeLonghand', [])
|
|
37
|
-
|
|
38
|
-
if (typeof mergeLonghandConfig === 'boolean' && mergeLonghandConfig) {
|
|
39
|
-
html = await posthtml([mergeLonghand()]).process(html, posthtmlOptions).then(result => result.html)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (isObject(mergeLonghandConfig) && !isEmpty(mergeLonghandConfig)) {
|
|
43
|
-
html = await posthtml([mergeLonghand({tags: mergeLonghandConfig})]).process(html, posthtmlOptions).then(result => result.html)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
33
|
return html
|
|
47
34
|
}
|
|
48
35
|
|