@vituum/vite-plugin-tailwindcss 1.1.0 → 2.0.0-next.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 (3) hide show
  1. package/README.md +6 -4
  2. package/index.js +30 -29
  3. package/package.json +22 -16
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
  <a href="https://nodejs.org/en/about/releases/"><img src="https://img.shields.io/node/v/@vituum/vite-plugin-tailwindcss.svg" alt="node compatility"></a>
3
3
 
4
4
  # ⚡️🎨 ViteTailwindCSS
5
- Adds out of the box support for TailwindCSS with following PostCSS plugins:
5
+ > For TailwindCSS v4+ use the [official plugin](https://tailwindcss.com/docs/installation/using-vite).
6
+
7
+ Adds out of the box support for TailwindCSS **v3** with following PostCSS plugins:
6
8
  * [`postcss-import`](https://www.npmjs.com/package/postcss-import)
7
9
  * [`postcss-nesting`](https://www.npmjs.com/package/postcss-nesting)
8
10
  * [`postcss-custom-media`](https://www.npmjs.com/package/postcss-custom-media)
@@ -20,7 +22,7 @@ export default {
20
22
  }
21
23
  ```
22
24
 
23
- * Don't forget to also add your `tailwind.config.js`, [learn more here](https://tailwindcss.com/docs/guides/vite).
25
+ * Don't forget to also add your `tailwind.config.js`, [learn more here](https://v3.tailwindcss.com/docs/guides/vite).
24
26
  * If you want to add more PostCSS plugins, add them via [css.postcss.plugins](https://vitejs.dev/config/shared-options.html#css-postcss).
25
27
  * If you want to use `postcss.config.cjs` add `css.postcss: process.cwd()`, PostCSS config and it's plugins will be used instead
26
28
 
@@ -28,5 +30,5 @@ Read the [docs](https://vituum.dev/config/plugins-options.html#vituum-postcss) t
28
30
 
29
31
  ### Requirements
30
32
 
31
- - [Node.js LTS (16.x)](https://nodejs.org/en/download/)
32
- - [Vite](https://vitejs.dev/)
33
+ - [Node.js LTS (24.x)](https://nodejs.org/en/download/)
34
+ - [Vite (8.x)](https://vitejs.dev/)
package/index.js CHANGED
@@ -2,9 +2,9 @@ import postcssImport from 'postcss-import'
2
2
  import postcssNesting from 'postcss-nesting'
3
3
  import postcssCustomMedia from 'postcss-custom-media'
4
4
  import tailwindcss from 'tailwindcss'
5
- import tailwindcssNesting from 'tailwindcss/nesting/index.js'
5
+ import tailwindcssNesting from 'tailwindcss/nesting'
6
6
  import autoprefixer from 'autoprefixer'
7
- import { getPackageInfo, merge } from 'vituum/utils/common.js'
7
+ import { getPackageInfo, deepMergeWith } from 'vituum/utils/common.js'
8
8
 
9
9
  const { name } = getPackageInfo(import.meta.url)
10
10
 
@@ -12,11 +12,11 @@ const { name } = getPackageInfo(import.meta.url)
12
12
  * @type {import('@vituum/vite-plugin-tailwindcss/types/index').PluginUserConfig}
13
13
  */
14
14
  const defaultOptions = {
15
- import: {},
16
- nesting: {},
17
- customMedia: {},
18
- autoprefixer: {},
19
- tailwindcss: undefined
15
+ import: {},
16
+ nesting: {},
17
+ customMedia: {},
18
+ autoprefixer: {},
19
+ tailwindcss: undefined,
20
20
  }
21
21
 
22
22
  /**
@@ -24,30 +24,31 @@ const defaultOptions = {
24
24
  * @returns {import('vite').Plugin}
25
25
  */
26
26
  const plugin = (options = {}) => {
27
- options = merge(defaultOptions, options)
27
+ options = deepMergeWith(defaultOptions, options)
28
28
 
29
- const postcssPlugins = [
30
- postcssImport(options.import),
31
- tailwindcssNesting(postcssNesting(options.nesting)),
32
- postcssCustomMedia(options.customMedia),
33
- tailwindcss(options.tailwindcss),
34
- autoprefixer(options.autoprefixer)
35
- ]
29
+ const postcssPlugins = [
30
+ postcssImport(options.import),
31
+ tailwindcssNesting(postcssNesting(options.nesting)),
32
+ postcssCustomMedia(options.customMedia),
33
+ tailwindcss(options.tailwindcss),
34
+ autoprefixer(options.autoprefixer),
35
+ ]
36
36
 
37
- return {
38
- name,
39
- enforce: 'pre',
40
- /** @param {import('@vituum/vite-plugin-tailwindcss/types/viteUserConfig').ViteUserConfig} userConfig */
41
- config (userConfig) {
42
- if (!userConfig?.css?.postcss && !userConfig?.css?.postcss?.plugins) {
43
- userConfig.css = userConfig.css || {}
44
- userConfig.css.postcss = userConfig.css.postcss || {}
45
- userConfig.css.postcss.plugins = postcssPlugins
46
- } else if (userConfig.css.postcss.plugins) {
47
- userConfig.css.postcss.plugins = postcssPlugins.concat(...userConfig.css.postcss.plugins)
48
- }
49
- }
50
- }
37
+ return {
38
+ name,
39
+ enforce: 'pre',
40
+ /** @param {import('@vituum/vite-plugin-tailwindcss/types/viteUserConfig').ViteUserConfig} userConfig */
41
+ config(userConfig) {
42
+ if (!userConfig?.css?.postcss && !userConfig?.css?.postcss?.plugins) {
43
+ userConfig.css = userConfig.css || {}
44
+ userConfig.css.postcss = userConfig.css.postcss || {}
45
+ userConfig.css.postcss.plugins = postcssPlugins
46
+ }
47
+ else if (userConfig.css.postcss.plugins) {
48
+ userConfig.css.postcss.plugins = postcssPlugins.concat(...userConfig.css.postcss.plugins)
49
+ }
50
+ },
51
+ }
51
52
  }
52
53
 
53
54
  export default plugin
package/package.json CHANGED
@@ -1,39 +1,45 @@
1
1
  {
2
2
  "name": "@vituum/vite-plugin-tailwindcss",
3
- "version": "1.1.0",
3
+ "version": "2.0.0-next.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
7
7
  "scripts": {
8
+ "lint": "npm run eslint && npm run tsc",
8
9
  "tsc": "tsc",
9
- "eslint": "eslint '**/*.js' --fix"
10
+ "eslint": "eslint '**/*.js' --fix",
11
+ "publish-next": "npm publish --tag next"
10
12
  },
11
13
  "dependencies": {
12
- "vituum": "^1.1",
14
+ "vituum": "^2.0.0-next.9",
13
15
  "autoprefixer": "^10.4",
14
- "postcss": "^8.4",
15
- "postcss-import": "^15.1",
16
- "postcss-nesting": "^12.0",
17
- "postcss-custom-media": "^10.0",
18
- "tailwindcss": "^3.3"
16
+ "postcss": "^8.5",
17
+ "postcss-import": "^16.1",
18
+ "postcss-nesting": "^14.0",
19
+ "postcss-custom-media": "^12.0",
20
+ "tailwindcss": "^3.4"
19
21
  },
20
22
  "devDependencies": {
21
- "@types/node": "^20.9.1",
22
- "vite": "^5.0.0",
23
- "eslint": "^8.53.0",
24
- "eslint-config-standard": "^17.1.0",
25
- "typescript": "^5.2.2"
23
+ "@eslint/js": "^9.39",
24
+ "@stylistic/eslint-plugin": "^5.7",
25
+ "@types/node": "^25.0",
26
+ "eslint": "^9.39",
27
+ "globals": "^17.0",
28
+ "typescript": "^5.9",
29
+ "vite": "^8.0.0-beta.8"
26
30
  },
27
31
  "files": [
28
32
  "index.js",
29
33
  "types"
30
34
  ],
31
35
  "exports": {
32
- ".": "./index.js",
33
- "./types": "./types/*"
36
+ ".": {
37
+ "default": "./index.js",
38
+ "types": "./types/index.d.ts"
39
+ }
34
40
  },
35
41
  "engines": {
36
- "node": "^18.0.0 || >=20.0.0"
42
+ "node": "^24.0.0 || >=25.0.0"
37
43
  },
38
44
  "repository": {
39
45
  "type": "git",