Installation
Fastest way to get started with any framework is:
npx salty-css init
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
- For Next.js support install
npm i @salty-css/next @salty-css/core @salty-css/react - Create
salty.config.tsto your app directory - Add Salty CSS plugin to next.js config:
- Next.js 15: In
next.config.tsadd import for salty pluginimport { withSaltyCss } from '@salty-css/next';and then addwithSaltyCssto wrap your nextConfig export like soexport default withSaltyCss(nextConfig); - Next.js 14 and older: In
next.config.jsadd import for salty pluginconst { withSaltyCss } = require('@salty-css/next');and then addwithSaltyCssto wrap your nextConfig export like somodule.exports = withSaltyCss(nextConfig);
- Next.js 15: In
- Make sure that
salty.config.tsandnext.config.tsare in the same folder! - Build
saltygendirectory by running your app once or with clinpx salty-css build [directory] - Import global styles from
saltygen/index.cssto some global css file with@import 'insert_path_to_index_css';.
React + Vite
- In your existing Vite 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
main.tsxand see it working!
Manual configuration
- For Vite support install
npm i @salty-css/vite @salty-css/core - In
vite.configadd import for salty pluginimport { saltyPlugin } from '@salty-css/vite';and then addsaltyPlugin(__dirname)to your vite configuration plugins - Make sure that
salty.config.tsandvite.config.tsare in the same folder! - Build
saltygendirectory by running your app once or with clinpx salty-css build [directory] - Import global styles from
saltygen/index.cssto some global css file with@import 'insert_path_to_index_css';.