@maizzle/framework 5.2.1 → 6.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "5.2.1",
3
+ "version": "6.0.0-0",
4
4
  "description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,6 +51,7 @@
51
51
  ],
52
52
  "dependencies": {
53
53
  "@maizzle/cli": "^2.0.0",
54
+ "@tailwindcss/postcss": "^4.1.11",
54
55
  "cheerio": "^1.0.0",
55
56
  "chokidar": "^3.6.0",
56
57
  "cli-table3": "^0.6.5",
@@ -70,10 +71,10 @@
70
71
  "pathe": "^2.0.0",
71
72
  "postcss": "^8.4.49",
72
73
  "postcss-calc": "^10.0.2",
73
- "postcss-color-functional-notation": "^7.0.10",
74
74
  "postcss-css-variables": "^0.19.0",
75
- "postcss-import": "^16.1.0",
75
+ "postcss-lightningcss": "^1.0.1",
76
76
  "postcss-safe-parser": "^7.0.0",
77
+ "postcss-sort-media-queries": "^5.2.0",
77
78
  "posthtml": "^0.16.6",
78
79
  "posthtml-attrs-parser": "^1.1.1",
79
80
  "posthtml-base-url": "^3.1.8",
@@ -93,11 +94,11 @@
93
94
  "posthtml-widows": "^1.0.0",
94
95
  "pretty": "^2.0.0",
95
96
  "string-strip-html": "^13.4.8",
96
- "tailwindcss": "^3.4.16",
97
+ "tailwindcss": "^4.1.11",
97
98
  "ws": "^8.18.0"
98
99
  },
99
100
  "devDependencies": {
100
- "@biomejs/biome": "2.0.5",
101
+ "@biomejs/biome": "2.1.1",
101
102
  "@types/js-beautify": "^1.14.3",
102
103
  "@types/markdown-it": "^14.1.2",
103
104
  "@vitest/coverage-v8": "^3.0.4",
@@ -10,14 +10,14 @@ import posthtmlPostcss from 'posthtml-postcss'
10
10
  import expandLinkTag from './plugins/expandLinkTag.js'
11
11
  import envAttributes from './plugins/envAttributes.js'
12
12
  import { getPosthtmlOptions } from './defaultConfig.js'
13
+ import combineMediaQueries from './plugins/combineMediaQueries.js'
13
14
 
14
15
  // PostCSS
15
- import tailwindcss from 'tailwindcss'
16
+ import tailwindcss from '@tailwindcss/postcss'
16
17
  import postcssCalc from 'postcss-calc'
17
- import postcssImport from 'postcss-import'
18
18
  import cssVariables from 'postcss-css-variables'
19
19
  import postcssSafeParser from 'postcss-safe-parser'
20
- import postcssColorFunctionalNotation from 'postcss-color-functional-notation'
20
+ import postcssLightningCss from 'postcss-lightningcss'
21
21
 
22
22
  import defaultComponentsConfig from './defaultComponentsConfig.js'
23
23
 
@@ -33,11 +33,18 @@ export async function process(html = '', config = {}) {
33
33
 
34
34
  const postcssPlugin = posthtmlPostcss(
35
35
  [
36
- postcssImport(),
37
36
  tailwindcss(get(config, 'css.tailwind', {})),
38
37
  resolveCSSProps !== false && cssVariables(resolveCSSProps),
39
38
  resolveCalc !== false && postcssCalc(resolveCalc),
40
- postcssColorFunctionalNotation(),
39
+ postcssLightningCss({
40
+ lightningcssOptions: {
41
+ errorRecovery: true,
42
+ minify: false,
43
+ targets: {
44
+ ie: 1,
45
+ }
46
+ }
47
+ }),
41
48
  ...get(config, 'postcss.plugins', []),
42
49
  ],
43
50
  merge(
@@ -114,6 +121,7 @@ export async function process(html = '', config = {}) {
114
121
  postcssPlugin,
115
122
  envTags(config.env),
116
123
  envAttributes(config.env),
124
+ combineMediaQueries(get(config, 'css.combineMediaQueries', { sort: 'mobile-first' })),
117
125
  ...get(
118
126
  config,
119
127
  'posthtml.plugins.after',
@@ -0,0 +1,42 @@
1
+ import postcss from 'postcss'
2
+ import sortMediaQueries from 'postcss-sort-media-queries'
3
+
4
+ const plugin = (options = {}) => tree => {
5
+ const process = node => {
6
+ // Check if this is a style tag with content
7
+ if (node.tag === 'style' && node.content && Array.isArray(node.content)) {
8
+ // Get the CSS content from the style tag
9
+ const cssContent = node.content.join('')
10
+
11
+ if (cssContent.trim()) {
12
+ try {
13
+ // Create PostCSS processor for combining and sorting media queries
14
+ const processor = postcss([
15
+ sortMediaQueries({
16
+ sort: options.sort || 'mobile-first',
17
+ ...options
18
+ })
19
+ ])
20
+
21
+ // Process CSS synchronously
22
+ const result = processor.process(cssContent, {
23
+ from: undefined,
24
+ to: undefined
25
+ })
26
+
27
+ // Replace the content with processed CSS
28
+ node.content = [result.css]
29
+ } catch (error) {
30
+ // If processing fails, leave the content unchanged
31
+ console.warn('Failed to process media queries:', error.message)
32
+ }
33
+ }
34
+ }
35
+
36
+ return node
37
+ }
38
+
39
+ return tree.walk(process)
40
+ }
41
+
42
+ export default plugin