@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
package/.editorconfig CHANGED
@@ -1,9 +1,9 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
@@ -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>
@@ -1,28 +1,28 @@
1
- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
-
4
- name: Node.js CI
5
-
6
- on:
7
- push:
8
- branches: [master]
9
- pull_request:
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
-
15
- strategy:
16
- matrix:
17
- node-version: [14, 16, 17]
18
-
19
- steps:
20
- - uses: actions/checkout@v2
21
- - name: Use Node.js ${{ matrix.node-version }}
22
- uses: actions/setup-node@v1
23
- with:
24
- node-version: ${{ matrix.node-version }}
25
- - run: npm install
26
- - run: npm test
27
- env:
28
- CI: true
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: Node.js CI
5
+
6
+ on:
7
+ push:
8
+ branches: [master]
9
+ pull_request:
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ matrix:
17
+ node-version: [14, 16, 18]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Use Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v1
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+ - run: npm install
26
+ - run: npm test
27
+ env:
28
+ CI: true
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Cosmin Popovici
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Cosmin Popovici
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,35 +1,42 @@
1
- <div align="center">
2
- <p><a href="https://maizzle.com" target="_blank"><img src="https://res.cloudinary.com/maizzle/image/upload/v1553710263/maizzle.svg" width="200" alt="Maizzle"></a></p>
3
- <p>HTML email development framework</p>
4
- <div>
5
-
6
- [![Version][npm-version-shield]][npm]
7
- [![Build][github-ci-shield]][github-ci]
8
- [![Downloads][npm-stats-shield]][npm-stats]
9
- [![License][license-shield]][license]
10
-
11
- </div>
12
- </div>
13
-
14
- ## About
15
-
16
- > **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).
17
-
18
- Maizzle is a framework that helps you quickly build HTML emails with [Tailwind CSS](https://tailwindcss.com/).
19
-
20
- ## Documentation
21
-
22
- Maizzle documentation is available at https://maizzle.com
23
-
24
- ## License
25
-
26
- The Maizzle framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
27
-
28
- [npm]: https://www.npmjs.com/package/@maizzle/framework
29
- [npm-stats]: https://npm-stat.com/charts.html?package=%40maizzle%2Fframework&from=2019-03-27
30
- [npm-version-shield]: https://img.shields.io/npm/v/@maizzle/framework.svg?style=flat-square
31
- [npm-stats-shield]: https://img.shields.io/npm/dt/@maizzle/framework.svg?style=flat-square&color=6875f5
32
- [github-ci]: https://github.com/maizzle/framework/actions
33
- [github-ci-shield]: https://img.shields.io/github/workflow/status/maizzle/framework/Node.js%20CI?style=flat-square
34
- [license]: ./LICENSE
35
- [license-shield]: https://img.shields.io/npm/l/@maizzle/framework.svg?style=flat-square&color=0e9f6e
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/bin/maizzle ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('@maizzle/cli')
package/package.json CHANGED
@@ -1,87 +1,91 @@
1
- {
2
- "name": "@maizzle/framework",
3
- "version": "4.0.0-alpha.8",
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
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/maizzle/framework.git"
10
- },
11
- "bugs": "https://github.com/maizzle/framework/issues",
12
- "homepage": "https://maizzle.com",
13
- "author": "Cosmin Popovici (https://github.com/cossssmin)",
14
- "keywords": [
15
- "maizzle",
16
- "tailwindcss",
17
- "responsive-email",
18
- "email-framework",
19
- "email-template",
20
- "email-marketing",
21
- "email-campaigns",
22
- "email-newsletter",
23
- "email-boilerplate",
24
- "html-emails"
25
- ],
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "scripts": {
30
- "test": "c8 ava -s",
31
- "pretest": "xo",
32
- "style": "xo",
33
- "release": "np"
34
- },
35
- "dependencies": {
36
- "autoprefixer": "^10.4.0",
37
- "browser-sync": "^2.26.13",
38
- "color-shorthand-hex-to-six-digit": "^3.0.2",
39
- "email-comb": "^5.2.0",
40
- "front-matter": "^4.0.0",
41
- "fs-extra": "^10.0.0",
42
- "glob-promise": "^4.1.0",
43
- "html-crush": "^4.0.0",
44
- "is-url-superb": "^5.0.0",
45
- "juice": "^8.0.0",
46
- "lodash": "^4.17.20",
47
- "ora": "^5.1.0",
48
- "postcss": "^8.4.4",
49
- "postcss-import": "^14.0.0",
50
- "postcss-merge-longhand": "^5.0.1",
51
- "posthtml": "^0.16.6",
52
- "posthtml-attrs-parser": "^0.1.1",
53
- "posthtml-base-url": "^1.0.1",
54
- "posthtml-content": "^0.0.3",
55
- "posthtml-expressions": "^1.8.1",
56
- "posthtml-extend": "^0.6.0",
57
- "posthtml-extra-attributes": "^1.0.0",
58
- "posthtml-fetch": "^2.2.0",
59
- "posthtml-markdownit": "^1.3.0",
60
- "posthtml-match-helper": "^1.0.3",
61
- "posthtml-modules": "^0.9.0",
62
- "posthtml-mso": "^1.0.4",
63
- "posthtml-postcss-merge-longhand": "^1.0.2",
64
- "posthtml-remove-attributes": "^1.0.0",
65
- "posthtml-safe-class-names": "^1.0.4",
66
- "posthtml-url-parameters": "^1.0.4",
67
- "pretty": "^2.0.0",
68
- "prevent-widows": "^1.0.2",
69
- "query-string": "^7.1.0",
70
- "string-strip-html": "^8.2.0",
71
- "tailwindcss": "^3.0.0"
72
- },
73
- "devDependencies": {
74
- "ava": "^4.0.1",
75
- "c8": "^7.11.0",
76
- "np": "*",
77
- "xo": "0.39.1"
78
- },
79
- "engines": {
80
- "node": ">=14.19.1"
81
- },
82
- "ava": {
83
- "files": [
84
- "test/**/test*.js"
85
- ]
86
- }
87
- }
1
+ {
2
+ "name": "@maizzle/framework",
3
+ "version": "4.0.1",
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.1.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
+ }
@@ -41,13 +41,27 @@ const serve = async (env = 'local', config = {}) => {
41
41
  const globalPaths = [
42
42
  'src/**',
43
43
  get(config, 'build.tailwind.config', 'tailwind.config.js'),
44
- [...new Set(get(config, 'build.browsersync.watch', []))]
44
+ ...new Set(get(config, 'build.browsersync.watch', []))
45
45
  ]
46
46
 
47
47
  // Watch for Template file changes
48
48
  browsersync()
49
49
  .watch(templatePaths)
50
50
  .on('change', async file => {
51
+ if (config.events && typeof config.events.beforeCreate === 'function') {
52
+ await config.events.beforeCreate(config)
53
+ }
54
+
55
+ // Don't render if file type is not configured
56
+ // eslint-disable-next-line
57
+ const filetypes = templates.reduce((acc, template) => {
58
+ return [...acc, ...get(template, 'filetypes', ['html'])]
59
+ }, [])
60
+
61
+ if (!filetypes.includes(path.extname(file).slice(1))) {
62
+ return
63
+ }
64
+
51
65
  if (get(config, 'build.console.clear')) {
52
66
  clearConsole()
53
67
  }
@@ -58,10 +72,6 @@ const serve = async (env = 'local', config = {}) => {
58
72
 
59
73
  file = file.replace(/\\/g, '/')
60
74
 
61
- if (config.events && typeof config.events.beforeCreate === 'function') {
62
- await config.events.beforeCreate(config)
63
- }
64
-
65
75
  const renderOptions = {
66
76
  maizzle: config,
67
77
  ...config.events
@@ -1,32 +1,32 @@
1
- const path = require('path')
2
- const {merge} = require('lodash')
3
- const {requireUncached} = require('../utils/helpers')
4
-
5
- module.exports = {
6
- getMerged: async (env = 'local') => {
7
- if (typeof env !== 'string') {
8
- throw new TypeError(`env name must be a string, received ${typeof env}(${env})`)
9
- }
10
-
11
- let baseConfig = {env}
12
- let envConfig = {env}
13
-
14
- const cwd = env === 'maizzle-ci' ? './test/stubs/config' : process.cwd()
15
-
16
- for (const module of ['./config', './config.local']) {
17
- try {
18
- baseConfig = merge(baseConfig, requireUncached(path.resolve(cwd, module)))
19
- } catch {}
20
- }
21
-
22
- if (typeof env === 'string' && env !== 'local') {
23
- try {
24
- envConfig = merge(envConfig, requireUncached(path.resolve(cwd, `./config.${env}`)))
25
- } catch {
26
- throw new Error(`could not load config.${env}.js`)
27
- }
28
- }
29
-
30
- return merge(baseConfig, envConfig)
31
- }
32
- }
1
+ const path = require('path')
2
+ const {merge} = require('lodash')
3
+ const {requireUncached} = require('../utils/helpers')
4
+
5
+ module.exports = {
6
+ getMerged: async (env = 'local') => {
7
+ if (typeof env !== 'string') {
8
+ throw new TypeError(`env name must be a string, received ${typeof env}(${env})`)
9
+ }
10
+
11
+ let baseConfig = {env}
12
+ let envConfig = {env}
13
+
14
+ const cwd = env === 'maizzle-ci' ? './test/stubs/config' : process.cwd()
15
+
16
+ for (const module of ['./config', './config.local']) {
17
+ try {
18
+ baseConfig = merge(baseConfig, requireUncached(path.resolve(cwd, module)))
19
+ } catch {}
20
+ }
21
+
22
+ if (typeof env === 'string' && env !== 'local') {
23
+ try {
24
+ envConfig = merge(envConfig, requireUncached(path.resolve(cwd, `./config.${env}`)))
25
+ } catch {
26
+ throw new Error(`could not load config.${env}.js`)
27
+ }
28
+ }
29
+
30
+ return merge(baseConfig, envConfig)
31
+ }
32
+ }
@@ -1,4 +1,4 @@
1
- module.exports = {
2
- toDisk: require('./to-disk'),
3
- toString: require('./to-string')
4
- }
1
+ module.exports = {
2
+ toDisk: require('./to-disk'),
3
+ toString: require('./to-string')
4
+ }