@astrojs/tailwind
Advanced tools
Comparing version 2.1.3 to 3.0.0-beta.0
# @astrojs/tailwind | ||
## 3.0.0-beta.0 | ||
### Major Changes | ||
- [#5717](https://github.com/withastro/astro/pull/5717) [`a3a7fc929`](https://github.com/withastro/astro/commit/a3a7fc9298e6d88abb4b7bee1e58f05fa9558cf1) Thanks [@bluwy](https://github.com/bluwy)! - Remove `style.postcss` Astro config. Refactor tailwind integration to configure through `vite` instead. Also disables `autoprefixer` in dev. | ||
## 2.1.3 | ||
@@ -123,3 +129,3 @@ | ||
- [`e425f896`](https://github.com/withastro/astro/commit/e425f896b668d98033ad3b998b50c1f28bc7f6ee) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Update config options to resepect [RFC0019](https://github.com/withastro/rfcs/blob/main/proposals/0019-config-finalization.md) | ||
- [`e425f896`](https://github.com/withastro/astro/commit/e425f896b668d98033ad3b998b50c1f28bc7f6ee) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Update config options to respect [RFC0019](https://github.com/withastro/rfcs/blob/main/proposals/0019-config-finalization.md) | ||
@@ -126,0 +132,0 @@ ### Patch Changes |
@@ -58,2 +58,15 @@ import load, { resolve } from "@proload/core"; | ||
} | ||
function getViteConfiguration(isBuild, tailwindConfig) { | ||
const postcssPlugins = [tailwindPlugin(tailwindConfig)]; | ||
if (isBuild) { | ||
postcssPlugins.push(autoprefixerPlugin()); | ||
} | ||
return { | ||
css: { | ||
postcss: { | ||
plugins: postcssPlugins | ||
} | ||
} | ||
}; | ||
} | ||
function tailwindIntegration(options) { | ||
@@ -66,3 +79,10 @@ var _a, _b; | ||
hooks: { | ||
"astro:config:setup": async ({ config, injectScript, addWatchFile, isRestart }) => { | ||
"astro:config:setup": async ({ | ||
command, | ||
config, | ||
updateConfig, | ||
injectScript, | ||
addWatchFile, | ||
isRestart | ||
}) => { | ||
const userConfig = await getUserConfig(config.root, customConfigPath, isRestart); | ||
@@ -80,4 +100,3 @@ if (customConfigPath && !(userConfig == null ? void 0 : userConfig.value)) { | ||
const tailwindConfig = (userConfig == null ? void 0 : userConfig.value) ?? getDefaultTailwindConfig(config.srcDir); | ||
config.style.postcss.plugins.push(tailwindPlugin(tailwindConfig)); | ||
config.style.postcss.plugins.push(autoprefixerPlugin); | ||
updateConfig({ vite: getViteConfiguration(command === "build", tailwindConfig) }); | ||
if (applyBaseStyles) { | ||
@@ -84,0 +103,0 @@ injectScript("page-ssr", `import '@astrojs/tailwind/base.css';`); |
{ | ||
"name": "@astrojs/tailwind", | ||
"description": "Tailwind + Astro Integrations", | ||
"version": "2.1.3", | ||
"version": "3.0.0-beta.0", | ||
"type": "module", | ||
@@ -31,3 +31,3 @@ "types": "./dist/index.d.ts", | ||
"devDependencies": { | ||
"astro": "1.6.11", | ||
"astro": "2.0.0-beta.1", | ||
"astro-scripts": "0.0.9", | ||
@@ -34,0 +34,0 @@ "tailwindcss": "^3.0.24" |
@@ -71,2 +71,4 @@ # @astrojs/tailwind 💨 | ||
[Autoprefixer](https://github.com/postcss/autoprefixer) is also setup automatically for production builds so Tailwind classes will work in older browsers. | ||
https://user-images.githubusercontent.com/4033662/169918388-8ed153b2-0ba0-4b24-b861-d6e1cc800b6c.mp4 | ||
@@ -73,0 +75,0 @@ |
@@ -69,2 +69,16 @@ import load, { resolve } from '@proload/core'; | ||
function getViteConfiguration(isBuild: boolean, tailwindConfig: TailwindConfig) { | ||
const postcssPlugins = [tailwindPlugin(tailwindConfig)]; | ||
if (isBuild) { | ||
postcssPlugins.push(autoprefixerPlugin()); | ||
} | ||
return { | ||
css: { | ||
postcss: { | ||
plugins: postcssPlugins, | ||
}, | ||
}, | ||
}; | ||
} | ||
type TailwindOptions = | ||
@@ -96,3 +110,10 @@ | { | ||
hooks: { | ||
'astro:config:setup': async ({ config, injectScript, addWatchFile, isRestart }) => { | ||
'astro:config:setup': async ({ | ||
command, | ||
config, | ||
updateConfig, | ||
injectScript, | ||
addWatchFile, | ||
isRestart, | ||
}) => { | ||
// Inject the Tailwind postcss plugin | ||
@@ -113,6 +134,5 @@ const userConfig = await getUserConfig(config.root, customConfigPath, isRestart); | ||
const tailwindConfig: TailwindConfig = | ||
const tailwindConfig = | ||
(userConfig?.value as TailwindConfig) ?? getDefaultTailwindConfig(config.srcDir); | ||
config.style.postcss.plugins.push(tailwindPlugin(tailwindConfig)); | ||
config.style.postcss.plugins.push(autoprefixerPlugin); | ||
updateConfig({ vite: getViteConfiguration(command === 'build', tailwindConfig) }); | ||
@@ -119,0 +139,0 @@ if (applyBaseStyles) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31162
270
199
1