@newlogic-digital/core 4.0.2 → 4.1.0-next.2
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/index.js +13 -0
- package/package.json +8 -7
- package/src/postcssCustomProperties.js +14 -0
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Features as LightningCssFeatures, browserslistToTargets } from 'lightni
|
|
|
10
10
|
import process from 'node:process'
|
|
11
11
|
import heroicons from '@newlogic-digital/vite-plugin-heroicons'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
|
+
import { processPostcssCustomProperties } from './src/postcssCustomProperties.js'
|
|
13
14
|
|
|
14
15
|
const { name } = getPackageInfo(import.meta.url)
|
|
15
16
|
|
|
@@ -79,6 +80,9 @@ const defaultOptions = {
|
|
|
79
80
|
const plugin = async (options = {}) => {
|
|
80
81
|
options = deepMergeWith(defaultOptions, options)
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @type import('vite').Plugin[]
|
|
85
|
+
*/
|
|
82
86
|
const optionalPlugins = []
|
|
83
87
|
|
|
84
88
|
if (options.format.includes('twig')) {
|
|
@@ -106,6 +110,15 @@ const plugin = async (options = {}) => {
|
|
|
106
110
|
if (options.cssInline.paths.length > 0) {
|
|
107
111
|
const cssInline = (await import('@vituum/vite-plugin-css-inline')).default
|
|
108
112
|
|
|
113
|
+
optionalPlugins.push({
|
|
114
|
+
name: '@newlogic-digital/core:postcss-custom-properties',
|
|
115
|
+
transform(code, id) {
|
|
116
|
+
if (id.endsWith('.css') && options.mode === 'emails') {
|
|
117
|
+
return processPostcssCustomProperties(code)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
|
|
109
122
|
optionalPlugins.push(cssInline(options.cssInline))
|
|
110
123
|
}
|
|
111
124
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.2",
|
|
4
|
+
"version": "4.1.0-next.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"newlogic-core": "./bin/newlogic-core.js"
|
|
@@ -18,17 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@minify-html/node": "^0.18.1",
|
|
21
|
-
"@newlogic-digital/vite-plugin-heroicons": "^1.
|
|
21
|
+
"@newlogic-digital/vite-plugin-heroicons": "^1.2.1",
|
|
22
22
|
"@stylistic/eslint-plugin": "^5.10",
|
|
23
|
-
"@stylistic/stylelint-config": "^
|
|
24
|
-
"@vituum/vite-plugin-css-inline": "^2.0.
|
|
23
|
+
"@stylistic/stylelint-config": "^5.0.0",
|
|
24
|
+
"@vituum/vite-plugin-css-inline": "^2.1.0-next.1",
|
|
25
25
|
"@vituum/vite-plugin-latte": "^2.0.2",
|
|
26
26
|
"@vituum/vite-plugin-send": "^2.0.1",
|
|
27
|
-
"browserslist": "^4.28.
|
|
27
|
+
"browserslist": "^4.28.2",
|
|
28
28
|
"browserslist-to-esbuild": "^2.1.1",
|
|
29
29
|
"lightningcss": "^1.32.0",
|
|
30
|
-
"npm-check-updates": "^
|
|
31
|
-
"oxlint": "^1.
|
|
30
|
+
"npm-check-updates": "^20.0.0",
|
|
31
|
+
"oxlint": "^1.58.0",
|
|
32
|
+
"postcss-custom-properties": "^15.0.1",
|
|
32
33
|
"stylelint-config-standard": "^40.0.0",
|
|
33
34
|
"vituum": "^2.0.1"
|
|
34
35
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import postcss from 'postcss'
|
|
2
|
+
import postcssCustomProperties from 'postcss-custom-properties'
|
|
3
|
+
|
|
4
|
+
export const processPostcssCustomProperties = (code, options = {
|
|
5
|
+
preserve: false,
|
|
6
|
+
}) => {
|
|
7
|
+
const processedCss = postcss(
|
|
8
|
+
[
|
|
9
|
+
postcssCustomProperties(options),
|
|
10
|
+
],
|
|
11
|
+
).process(code)
|
|
12
|
+
|
|
13
|
+
return processedCss.css.replace(/\s*--[\w-]+\s*:\s*[^;]*;/g, '')
|
|
14
|
+
}
|