Installation
Fastest way to get started with any framework is:
npx salty-css init
For a manual install on Next.js, run:
npm i @salty-css/next @salty-css/react
Next App Router supports RSC out of the box.
Next.js
- In your existing Next.js repository you can run
npx salty-css initto automatically configure Salty CSS. - Create your first Salty CSS component with
npx salty-css generate [filePath](e.g.src/custom-wrapper). - Import your component for example to
page.tsxand see it working!
Manual configuration
- Install the Next.js plugin and the runtime packages:
npm i @salty-css/next @salty-css/core @salty-css/react - Create
salty.config.tsin your app directory. - Wire the plugin into your Next config:
- Next.js 15 — in
next.config.ts:import { withSaltyCss } from "@salty-css/next"; export default withSaltyCss(nextConfig); - Next.js 14 and older — in
next.config.js:const { withSaltyCss } = require("@salty-css/next"); module.exports = withSaltyCss(nextConfig);
- Next.js 15 — in
- Make sure that
salty.config.tsandnext.config.tsare in the same folder. - Build the
saltygendirectory by running your app once or via the CLI:npx salty-css build [directory]. - Import global styles from
saltygen/index.cssin some global css file:@import 'insert_path_to_index_css';.
Next App Router supports RSC out of the box.