@themeshift/next
v0.2.0
Published
Next.js wrapper for ThemeShift core token tooling.
Readme
@themeshift/next
ThemeShift wrapper for Next.js apps.
@themeshift/next runs ThemeShift token builds for next build and starts token
watch mode during next dev, while preserving your existing Next config.
Install
npm install --save-dev @themeshift/next sassQuick start
import { withThemeShift } from '@themeshift/next';
export default withThemeShift(
{
reactStrictMode: true,
},
{
cssVarPrefix: 'themeshift',
}
);Curried form is also supported:
import { withThemeShift } from '@themeshift/next';
const withTokens = withThemeShift({ cssVarPrefix: 'themeshift' });
export default withTokens({ reactStrictMode: true });What it adds
- Runs a token build in
next build - Starts token watch mode in
next dev(webpack and Turbopack) - Injects a global Sass
token()helper throughsassOptions.additionalData - Keeps your existing
webpackandsassOptionsbehavior intact
Token helpers
Import token helpers from @themeshift/next/token:
import { token, tokenValue } from '@themeshift/next/token';Import Sass helper module:
@use '@themeshift/next/token' as themeShift;
.button {
color: themeShift.token('text.primary');
}ThemeShift options
The second argument takes @themeshift/core options such as:
extendscssVarPrefixdefaultThemefiltersoutputComments
License
MIT
