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 init
to 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.tsx
and see it working!
Manual configuration
- For Next.js support install
npm i @salty-css/next @salty-css/core @salty-css/react
- Create
salty.config.ts
to your app directory - Add Salty CSS plugin to next.js config:
- Next.js 15: In
next.config.ts
add import for salty pluginimport { withSaltyCss } from '@salty-css/next';
and then addwithSaltyCss
to wrap your nextConfig export like soexport default withSaltyCss(nextConfig);
- Next.js 14 and older: In
next.config.js
add import for salty pluginconst { withSaltyCss } = require('@salty-css/next');
and then addwithSaltyCss
to wrap your nextConfig export like somodule.exports = withSaltyCss(nextConfig);
- Next.js 15: In
- Make sure that
salty.config.ts
andnext.config.ts
are in the same folder! - Build
saltygen
directory by running your app once or with clinpx salty-css build [directory]
- Import global styles from
saltygen/index.css
to some global css file with@import 'insert_path_to_index_css';
.
React + Vite
- In your existing Vite repository you can run
npx salty-css init
to 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.tsx
and see it working!
Manual configuration
- For Vite support install
npm i @salty-css/vite @salty-css/core
- In
vite.config
add import for salty pluginimport { saltyPlugin } from '@salty-css/vite';
and then addsaltyPlugin(__dirname)
to your vite configuration plugins - Make sure that
salty.config.ts
andvite.config.ts
are in the same folder! - Build
saltygen
directory by running your app once or with clinpx salty-css build [directory]
- Import global styles from
saltygen/index.css
to some global css file with@import 'insert_path_to_index_css';
.