diff options
author | 2022-04-02 13:29:59 -0500 | |
---|---|---|
committer | 2022-04-02 12:29:59 -0600 | |
commit | 17c02925c52027246000305cea1f9a7b6f484b00 (patch) | |
tree | 687b8ca9e7b89b06dad65ae195619ea2ea50f57b /packages/integrations/tailwind/src | |
parent | 76f6643dddb9343218020cf7585be92a1fe45d3a (diff) | |
download | astro-17c02925c52027246000305cea1f9a7b6f484b00.tar.gz astro-17c02925c52027246000305cea1f9a7b6f484b00.tar.zst astro-17c02925c52027246000305cea1f9a7b6f484b00.zip |
Migrate to new config (#2962)
* wip: config migration
* fix: formatting
* refactor: projectRoot -> root
* refactor: pageUrlFormat -> format
* refactor: buildOptions.site -> site
* refactor: public -> publicDir
* refactor: dist -> outDir
* refactor: styleOptions -> style
* fix: some dist tests -> outDir
* refactor: remove legacyBuild (with TODOs)
* refactor: more legacyBuild cleanup
* refactor: server host and port
* fix: remove experimentalStaticBuild CLI flag
* refactor: src -> srcDir
* refactor: devOptions.trailing -> trailing
* refactor: remove sitemap + related flags
* refactor: experimentalSSR -> experimental.ssr
* fix: last devOptions
* refactor: drafts -> markdown.drafts
* fix: TS error on port as const
* refactor: remove pages
* refactor: more --project-root updates
* refactor: markdownOptions -> markdown
* fix: remaining type errors
* feat: update AstroUserConfig
* refactor: update CLI flag mapper + server mapper
* fix: loadFixture projectRoot
* fix: merge CLI flags before validating / transforming
* wip: attempt to fix bad createRouteManifest config
* refactor: combine config.base and config.site
* fix: skip route manifest test for now
* fix: site and base handling
* refactor: update failing config testes
* fix: build failure
* feat: update config types with migration help
* chore: update types
* fix(deno): update deno fixture
* chore: remove config migration logic
* chore: remove logLevel
* chore: clean-up config types
* chore: update config warning
* chore: add changeset
* Sitemap Integration (#2965)
* feat: add sitemap filter config option
* feat: add canonicalURL sitemap config option
* docs: update sitemap README
* fix: update for new config
* fix: filter not being applied
* chore: changeset
Co-authored-by: bholmesdev <hey@bholmes.dev>
* fred pass
* fix: Astro.resolve typo
* fix: public => publicDir
Co-authored-by: bholmesdev <hey@bholmes.dev>
Co-authored-by: Fred K. Schott <fkschott@gmail.com>
Diffstat (limited to 'packages/integrations/tailwind/src')
-rw-r--r-- | packages/integrations/tailwind/src/index.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/packages/integrations/tailwind/src/index.ts b/packages/integrations/tailwind/src/index.ts index 3bdd65011..2f469b507 100644 --- a/packages/integrations/tailwind/src/index.ts +++ b/packages/integrations/tailwind/src/index.ts @@ -17,16 +17,16 @@ function getDefaultTailwindConfig(srcUrl: URL): TailwindConfig { }); } -async function getUserConfig(projectRoot: URL, configPath?: string) { - const resolvedProjectRoot = fileURLToPath(projectRoot); +async function getUserConfig(root: URL, configPath?: string) { + const resolvedRoot = fileURLToPath(root); let userConfigPath: string | undefined; if (configPath) { const configPathWithLeadingSlash = /^\.*\//.test(configPath) ? configPath : `./${configPath}`; - userConfigPath = fileURLToPath(new URL(configPathWithLeadingSlash, projectRoot)); + userConfigPath = fileURLToPath(new URL(configPathWithLeadingSlash, root)); } - return await load('tailwind', { mustExist: false, cwd: resolvedProjectRoot, filePath: userConfigPath }); + return await load('tailwind', { mustExist: false, cwd: resolvedRoot, filePath: userConfigPath }); } type TailwindOptions = @@ -64,21 +64,21 @@ export default function tailwindIntegration(options: TailwindOptions): AstroInte hooks: { 'astro:config:setup': async ({ config, injectScript }) => { // Inject the Tailwind postcss plugin - const userConfig = await getUserConfig(config.projectRoot, customConfigPath); + const userConfig = await getUserConfig(config.root, customConfigPath); if (customConfigPath && !userConfig?.value) { throw new Error(`Could not find a Tailwind config at ${JSON.stringify(customConfigPath)}. Does the file exist?`); } - const tailwindConfig: TailwindConfig = (userConfig?.value as TailwindConfig) ?? getDefaultTailwindConfig(config.src); + const tailwindConfig: TailwindConfig = (userConfig?.value as TailwindConfig) ?? getDefaultTailwindConfig(config.srcDir); if (applyAstroConfigPreset && userConfig?.value) { // apply Astro config as a preset to user config // this avoids merging or applying nested spread operators ourselves - tailwindConfig.presets = [getDefaultTailwindConfig(config.src), ...(tailwindConfig.presets || [])]; + tailwindConfig.presets = [getDefaultTailwindConfig(config.srcDir), ...(tailwindConfig.presets || [])]; } - config.styleOptions.postcss.plugins.push(tailwindPlugin(tailwindConfig)); - config.styleOptions.postcss.plugins.push(autoprefixerPlugin); + config.style.postcss.plugins.push(tailwindPlugin(tailwindConfig)); + config.style.postcss.plugins.push(autoprefixerPlugin); if (applyBaseStyles) { // Inject the Tailwind base import |