PostCSS
Add PostCSS transformations by creating a config file and installing your plugins.
If the project contains a valid PostCSS config (any format supported by postcss-load-config, e.g. postcss.config.cjs), it will be automatically applied to all imported CSS.
INFO
As of v3.3, kirbyup no longer applies any default PostCSS plugins. This aligns with Kirby 4 and newer, which uses plain Vite without additional PostCSS configurations.
Without a custom configuration, no PostCSS transformations will be applied beyond what Vite provides by default.
Example: Autoprefixer
Add vendor prefixes automatically with Autoprefixer:
1. Install the plugin:
pnpm add -D autoprefixernpm i -D autoprefixer2. Create postcss.config.cjs:
module.exports = {
plugins: {
autoprefixer: {},
},
}Example: Tailwind CSS
Use Tailwind CSS for utility-first styling:
1. Install the dependencies:
pnpm add -D tailwindcss@3 autoprefixernpm i -D tailwindcss@3 autoprefixer2. Create postcss.config.cjs:
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}3. Create tailwind.config.cjs:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{vue,js}'],
theme: {
extend: {},
},
plugins: [],
}TIP
Check out the Tailwind CSS starter for a complete example.
Sass/SCSS Support
kirbyup includes built-in Sass support. No additional configuration is required – simply use .scss or .sass files in your Vue components:
<style lang="scss">
$primary: #5d5dff;
.my-section {
padding: 1rem;
&__title {
color: $primary;
font-weight: bold;
}
&:hover {
background: lighten($primary, 40%);
}
}
</style>You can also import external Sass files:
<style lang="scss">
@import './variables.scss';
@import './mixins.scss';
.my-component {
@include card-shadow;
color: $text-color;
}
</style>