Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tailwind): support v4 #13049

Merged
merged 29 commits into from
Jan 29, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5619b9d
feat: work on tailwind v4
florian-lefebvre Jan 23, 2025
375f7f9
feat: refactor
florian-lefebvre Jan 23, 2025
dc7e433
test
florian-lefebvre Jan 23, 2025
5c9f155
feat: write file
florian-lefebvre Jan 23, 2025
c78b6ef
feat: update fixture
florian-lefebvre Jan 23, 2025
6af5580
feat: create css file
florian-lefebvre Jan 23, 2025
bc11481
feat: astro add
florian-lefebvre Jan 23, 2025
83eea24
feat: example
florian-lefebvre Jan 23, 2025
8e774c9
feat: todos
florian-lefebvre Jan 23, 2025
c397877
Update .changeset/four-chairs-exercise.md
florian-lefebvre Jan 23, 2025
74f8d17
fix: typo
florian-lefebvre Jan 23, 2025
b56f2fb
fix: test
florian-lefebvre Jan 23, 2025
a2b75db
fix: test
florian-lefebvre Jan 23, 2025
8d14fee
fix: color
florian-lefebvre Jan 23, 2025
7ee87b9
Update .changeset/four-chairs-exercise.md
florian-lefebvre Jan 23, 2025
f2da6d8
fix: tests
florian-lefebvre Jan 23, 2025
bc0829b
Merge branch 'feat/tailwind-v4' of https://github.com/withastro/astro…
florian-lefebvre Jan 23, 2025
2b523d9
chore: changeset
florian-lefebvre Jan 23, 2025
1990a1d
Update curvy-penguins-act.md
florian-lefebvre Jan 24, 2025
773187e
Merge branch 'main' into feat/tailwind-v4
florian-lefebvre Jan 27, 2025
9de3c4f
Discard changes to packages/integrations/tailwind/base.css
florian-lefebvre Jan 27, 2025
93b81be
Discard changes to packages/integrations/tailwind/package.json
florian-lefebvre Jan 27, 2025
c0a90e1
Discard changes to packages/integrations/tailwind/src/index.ts
florian-lefebvre Jan 27, 2025
45e920d
Discard changes to packages/integrations/tailwind/test/basic.test.js
florian-lefebvre Jan 27, 2025
5e18866
Discard changes to packages/integrations/tailwind/test/fixtures/basic…
florian-lefebvre Jan 27, 2025
97a220a
Discard changes to packages/integrations/tailwind/test/fixtures/basic…
florian-lefebvre Jan 27, 2025
079cb5a
feat: update changeset
florian-lefebvre Jan 27, 2025
09f0542
chore: deps
florian-lefebvre Jan 27, 2025
f620e48
Update .changeset/curvy-penguins-act.md
florian-lefebvre Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: create css file
florian-lefebvre committed Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 6af5580a6559732fb0915c6c9efc8a421022135f
45 changes: 21 additions & 24 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
@@ -51,14 +51,7 @@ const ALIASES = new Map([

const STUBS = {
ASTRO_CONFIG: `import { defineConfig } from 'astro/config';\n// https://astro.build/config\nexport default defineConfig({});`,
TAILWIND_CONFIG: `/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [],
}\n`,
TAILWIND_GLOBAL_CSS: `@import "tailwindcss";`,
SVELTE_CONFIG: `\
import { vitePreprocess } from '@astrojs/svelte';
@@ -154,23 +147,26 @@ export async function add(names: string[], { flags }: AddOptions) {
switch (installResult) {
case UpdateResult.updated: {
if (integrations.find((integration) => integration.id === 'tailwind')) {
await setupIntegrationConfig({
root,
logger,
const dir = new URL('./styles/', new URL(userConfig.srcDir ?? './src/', root));
const styles = new URL('./global.css', dir);
if (!existsSync(styles)) {
logger.info(
'SKIP_FORMAT',
`\n ${magenta(`Astro will scaffold ${green('./src/styles.global.css')}.`)}\n`,
florian-lefebvre marked this conversation as resolved.
Show resolved Hide resolved
);

flags,
integrationName: 'Tailwind',
possibleConfigFiles: [
'./tailwind.config.cjs',
'./tailwind.config.mjs',
'./tailwind.config.ts',
'./tailwind.config.mts',
'./tailwind.config.cts',
'./tailwind.config.js',
],
defaultConfigFile: './tailwind.config.mjs',
defaultConfigContent: STUBS.TAILWIND_CONFIG,
});
if (await askToContinue({ flags })) {
await fs.mkdir(dir);
await fs.writeFile(styles, STUBS.TAILWIND_GLOBAL_CSS, 'utf-8');
} else {
logger.info(
'SKIP_FORMAT',
`\n @astrojs/tailwind requires additional configuration. Please refer to TODO:`,
);
}
} else {
logger.debug('add', `Using existing tailwind configuration`);
}
}
if (integrations.find((integration) => integration.id === 'svelte')) {
await setupIntegrationConfig({
@@ -304,6 +300,7 @@ export async function add(names: string[], { flags }: AddOptions) {

if (mod) {
try {
// TODO: special case for tailwind
configResult = await updateAstroConfig({
configURL,
mod,