@unocss/nuxt 0.47.0 → 0.47.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/dist/index.mjs +14 -3
- package/package.json +14 -13
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
|
|
|
3
3
|
import { defineNuxtModule, addPluginTemplate, isNuxt2, addComponentsDir, extendWebpackConfig } from '@nuxt/kit';
|
|
4
4
|
import WebpackPlugin from '@unocss/webpack';
|
|
5
5
|
import VitePlugin from '@unocss/vite';
|
|
6
|
+
import { loadConfig } from '@unocss/config';
|
|
6
7
|
import presetUno from '@unocss/preset-uno';
|
|
7
8
|
import presetAttributify from '@unocss/preset-attributify';
|
|
8
9
|
import presetIcons from '@unocss/preset-icons';
|
|
@@ -47,7 +48,7 @@ const index = defineNuxtModule({
|
|
|
47
48
|
icons: false,
|
|
48
49
|
wind: false
|
|
49
50
|
},
|
|
50
|
-
setup(options, nuxt) {
|
|
51
|
+
async setup(options, nuxt) {
|
|
51
52
|
resolveOptions(options);
|
|
52
53
|
if (options.autoImport) {
|
|
53
54
|
addPluginTemplate({
|
|
@@ -69,9 +70,19 @@ const index = defineNuxtModule({
|
|
|
69
70
|
watch: false
|
|
70
71
|
});
|
|
71
72
|
}
|
|
73
|
+
const { config: unoConfig } = await loadConfig(process.cwd(), {}, [], options);
|
|
74
|
+
if (nuxt.options.postcss.plugins.cssnano && unoConfig.transformers?.some((t) => t.name === "css-directive" && t.enforce !== "pre")) {
|
|
75
|
+
const preset = nuxt.options.postcss.plugins.cssnano.preset;
|
|
76
|
+
nuxt.options.postcss.plugins.cssnano = {
|
|
77
|
+
preset: [preset?.[0] || "default", Object.assign(
|
|
78
|
+
preset?.[1] || {},
|
|
79
|
+
{ mergeRules: false }
|
|
80
|
+
)]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
72
83
|
nuxt.hook("vite:extend", ({ config }) => {
|
|
73
84
|
config.plugins = config.plugins || [];
|
|
74
|
-
config.plugins.unshift(...VitePlugin(
|
|
85
|
+
config.plugins.unshift(...VitePlugin(unoConfig));
|
|
75
86
|
});
|
|
76
87
|
if (isNuxt2()) {
|
|
77
88
|
nuxt.hook("app:resolve", (config) => {
|
|
@@ -84,7 +95,7 @@ const index = defineNuxtModule({
|
|
|
84
95
|
}
|
|
85
96
|
extendWebpackConfig((config) => {
|
|
86
97
|
config.plugins = config.plugins || [];
|
|
87
|
-
config.plugins.unshift(WebpackPlugin(
|
|
98
|
+
config.plugins.unshift(WebpackPlugin(unoConfig));
|
|
88
99
|
});
|
|
89
100
|
}
|
|
90
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/nuxt",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.2",
|
|
4
4
|
"description": "Nuxt module for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,18 +38,19 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@nuxt/kit": "^3.0.0",
|
|
41
|
-
"@unocss/
|
|
42
|
-
"@unocss/
|
|
43
|
-
"@unocss/preset-
|
|
44
|
-
"@unocss/preset-
|
|
45
|
-
"@unocss/preset-
|
|
46
|
-
"@unocss/preset-
|
|
47
|
-
"@unocss/preset-
|
|
48
|
-
"@unocss/preset-
|
|
49
|
-
"@unocss/
|
|
50
|
-
"@unocss/
|
|
51
|
-
"@unocss/
|
|
52
|
-
"unocss": "0.47.
|
|
41
|
+
"@unocss/config": "0.47.2",
|
|
42
|
+
"@unocss/core": "0.47.2",
|
|
43
|
+
"@unocss/preset-attributify": "0.47.2",
|
|
44
|
+
"@unocss/preset-icons": "0.47.2",
|
|
45
|
+
"@unocss/preset-tagify": "0.47.2",
|
|
46
|
+
"@unocss/preset-typography": "0.47.2",
|
|
47
|
+
"@unocss/preset-uno": "0.47.2",
|
|
48
|
+
"@unocss/preset-web-fonts": "0.47.2",
|
|
49
|
+
"@unocss/preset-wind": "0.47.2",
|
|
50
|
+
"@unocss/reset": "0.47.2",
|
|
51
|
+
"@unocss/vite": "0.47.2",
|
|
52
|
+
"@unocss/webpack": "0.47.2",
|
|
53
|
+
"unocss": "0.47.2"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@nuxt/schema": "^3.0.0"
|