Guide
Guide to the tasks needed to migrate from Sprout to Crispy.
Migration Overview
To migrate from Sprout to Crispy, proceed in the order shown below.
- Analyze previous version usage
- Install Crispy
- Foundation migration (batch application recommended)
- Component migration (screen-by-screen application recommended and incremental application possible)
Foundation migration is applied as a batch replacement across the entire project. Components can be applied afterward on a screen-by-screen basis or incrementally by component.
Installing Crispy
Perform the foundational work needed to use Crispy first. After completing the work below, Crispy usage is available.
Installing Dependencies
Install the required dependencies.
@seed-design/reactincludes the complete React component library.- It replaces the existing
sproutpackages. - Use the existing packages until component migration is complete.
- It replaces the existing
@seed-design/cssincludes everything related to styles (vars, theming, recipe, css, etc.).- It replaces the existing
@seed-design/stylesheetlibrary. - It replaces the existing
@seed-design/design-tokenlibrary. - Use the existing packages until foundation migration is complete.
- It replaces the existing
CSS import
It is interoperable with the global.css of the Sprout @seed-design/stylesheet package.
For how to use the Crispy stylesheet, refer to the Installation CSS import guide.
Applying Theme
Changes
The data-attribute used in the previous Sprout has changed.
data-seed: Apply Crispy global theme (kept as-is in Crispy)data-seed-color-mode: Force apply Crispy theme- You can choose one of
light-only,dark-only, orsystem.
- You can choose one of
data-seed-user-color-scheme: User device settings- Has a value of either
lightordark. - If you have code using the
data-seed-scale-colorattribute in Sprout, change it to thedata-seed-user-color-schemeattribute.
- Has a value of either
Theming
Check the detailed explanation and usage methods for theme attributes.
While you can apply these attributes directly, the plugin application method is recommended.
If you are using an unsupported bundler, apply it using the script application method directly.
Plugin Application
For projects using bundlers such as Vite, Rsbuild, and Webpack, you can apply Theming immediately by adding a plugin.
When using Vite
When using Rsbuild
When using Webpack
Script Application
Generate a script using the generateThemingScript function provided by the @seed-design/css/theming package.
Apply the generated script directly.
Alternatively, you can write the script directly.
Foundation Migration
Foundation migration requires work on two main areas: Color and Typography.
Analyzing Usage
First, you need to analyze how the @seed-design/design-token package is used in the current project.
- Usage of vars from the
@seed-design/design-tokenpackage - Components that extend and use vars from the
@seed-design/design-tokenpackage - Code usage of the components mentioned above
- Usage of the
@seed-design/stylesheetpackage - Usage of CSS Variables starting with the
--seed-prefix - Usage combining the CSS library in use with the
@seed-design/design-tokenpackage
You can also analyze the usage in your current project using the prompt below.
Migration Strategy
- If you are using multiple packages, migrate the common packages first.
- If using preprocessing, it is better to first migrate the preprocessing code itself to Crispy and then migrate the remaining code using Codemod.
- While Color and Typography can be done separately, it is more efficient to migrate Color and Typography simultaneously and then perform QA once.
Typography Preset
Many projects create and use utility functions based on existing typography tokens.
In such cases, refer to the code below, perform preprocessing, and then change the code accordingly.
- You can migrate using the replace-custom-seed-design-typography custom transform.
Codemod
Migration is basically done using Codemod.
- Codemod provides separate
colorandtypographytransforms by default. - Currently, it provides transforms for CSS-in-JS libraries such as Tailwind CSS, Stitches, Emotion, and Vanilla Extract CSS.
- Custom transforms provided by each team are provided with the
replace-custom-prefix. - You can review examples of custom transform changes and use them if your project has the same situation.
- Additionally, you can create a custom transform if a specific library's transform is needed. (Contact the Design Core team)
Tailwind CSS
- Provides Tailwind V3 plugin.
- @seed-design/tailwind3-plugin
- @seed-design/tailwind4-theme
- Tailwind provides two transforms: replace-tailwind-typography and replace-tailwind-color.
- In the case of Tailwind, many projects write and use custom plugins, so Codemod may not be accurate.
- Review the change examples on the Codemod page and use them if your project has the same situation.
- If the example doesn't match, please contact the Design Core team.
Stitches CSS
- Stitches is provided in the form of replace-stitches-styled-typography, replace-stitches-styled-color, and replace-stitches-theme-color.
- For more details, refer to the Codemod page.
Emotion, Vanilla Extract CSS, (CSS-in-JS)
- CSS-in-JS libraries such as Emotion and Vanilla Extract CSS usually use
@seed-design/design-token. - You can migrate en masse using the replace-seed-design-token-vars transform.
- This transform changes both
colorandtypographysimultaneously.
Native CSS
- Basically, there are cases where CSS Variables with the
--seed-prefix are used. - We also provide the replace-css-seed-design-color-variable CSS transform.
Codemod Usage Precautions
Since Codemod changes multiple files, care is required.
- It is recommended to use a separate branch to track changes and manage history.
- It is recommended to divide commits by transform.
- Run
lintandtestafter running Codemod.
Codemod Log File
You can generate log files that help with debugging when running Codemod.
- Add the
--logoption. - Log files are created in the
.reportfolder at the Codemod execution path. - Log files help track changes and manage history.
debug.log
- Records debugging information.
- Records the file paths and times of attempted changes.
issues.log
- Records changes that need review.
- Records the problematic file path and line number.
- Records the reason for the problem.
- Except for cases without mapping, changes have already been made.
Common issues are organized at the bottom in How do I resolve issues in the issues.log file?.
success.log
- Helps track changes.
- Records the changed file paths and line numbers.
- Records the changed tokens.
- For transforms that change CSS files, tokens are not recorded individually.
- For cases like tailwind, the changed className is recorded.
Sprout-Crispy Compatibility
After completing the Color and Typography migration, there may be compatibility issues with existing Sprout components.
We provide a Compatibility version of Sprout with all Sprout tokens replaced with Crispy tokens inside. Foundation migration is considered complete once you progress to this point.
On the Sprout Compatibility version page,
replace all components with the latest version that has the -v3-compat tag. (All components provide the same version.)
Note: If using a very old version, there may be breaking changes within the components.
Once you have installed the Sprout-Crispy Compatibility version, foundation migration is considered complete.
In theory, you can now remove the @seed-design/design-token and @seed-design/stylesheet packages.
Also, you can incrementally use Crispy components.
Removing Compat Script
The script that was previously added to change the Sprout background color to Crispy for app version 25.10.0 and later can be removed after migration is complete.
Component Migration
TBD
Frequently Asked Questions
How do I resolve issues in the issues.log file?
Token mapping fails (Color, Typography)
- This occurs when using tokens not supported by Crispy. (Mainly alpha color tokens or very small or large typography tokens.)
- To check token mapping, refer to the explanation.
- In this case, consult with the designer and manually map to another appropriate token.
- If you have difficulty with the decision, contact the Design Core team.
Alpha token disappeared (Color)
- In most cases, tokens with alpha are no longer used.
- Apply the
alphachannel directly in CSS. (Use the opacity property or apply directly in rgba format)
Static token changed to palette (Color)
- In Crispy, static color tokens typically only support
whiteandblack. - Other colors (yellow, green, blue, red, gray) etc. have been changed to palette tokens.
- Verification is needed because colors may vary depending on dark mode and light mode.
- The background might change while text color doesn't, or vice versa.
- In most cases, it was changed to palette tokens because static tokens are not needed.
- In this case, consult with the designer and manually map the existing static token to another appropriate palette token.
Token mapped to two choices (Color)
- In some color token cases, there are two alternative tokens. (e.g.,
primary->bg.brand-solid,fg.brand) fgis a color used for foreground elements of the UI such as text and icons. (color, fill, etc.)bgis a color used for the entire screen or UI background. (backgroundColor, etc.)- Codemod may have difficulty determining which token needs to be changed.
- In this case, manually map to an appropriate token.
Changed to alternate token (Typography)
- Basically, Mapping supports 1:1 mapping.
- However, if the token is deprecated in Crispy, it can be mapped to an alternative token.
- In such cases, the font size or line height may have changed.
- In this case, you need to verify the UI directly.
Where can I check foundation token mapping?
You can check token mapping at Migration Reference.
Known Issues
When using Vanilla Extract CSS + Vite + Crispy
- Build may fail when using
@vanilla-extract/vite-pluginand@seed-design/vite-plugintogether. - Upgrade
@vanilla-extract/vite-pluginto version5or later.