🔺 Add PostCSS to Svelte

This is an adder for svelte-add; you should read its README before continuing here.

➕ Adding PostCSS

This adder's codename is postcss, and can be used like so:

npx svelte-add@latest postcss

🏞 Supported environments

This adder supports SvelteKit and Vite-powered Svelte apps (all the environments svelte-add currently supports).

⚙️ Options

  • autoprefixer (default true): whether or not to install and set up Autoprefixer.
npx svelte-add@latest postcss --postcss-autoprefixer

🛠 Using PostCSS

After the adder runs,

  • You can write PostCSS syntax in the style lang="postcss" blocks in Svelte files.

  • You can write PostCSS syntax in the src/app.pcss file.

    This is your global stylesheet because it will be active on every page of your site.

  • You can install more PostCSS plugins and configure them in the postcss.config.cjs file.

Top categories

Loading Svelte Themes