Syncing components
To use Subframe components in your app, you will need to sync them to your codebase. This will create a local copy of the code for your Subframe components. You can then use the Subframe CLI to update the component code whenever you add or change components in Subframe.
Sync goes one way from Subframe to your codebase. This means that if you make changes to a Subframe component’s code in your codebase, those changes will be overwritten the next time you sync.
Running the sync command
Make sure to first install Subframe. To sync the code for all of your components to your codebase run the following command:
You can also provide arguments to the command to sync only specific components, all components, and to directly install all necessary dependencies:
For example, to only sync the <Alert />
and <Accordion />
components, you can run:
Disabling sync
If you make changes to a Subframe component’s code in your codebase, those changes will be overwritten the next time you sync. To prevent your changes from being overwritten, you can disable syncing the component by adding // @subframe/sync-disable
anywhere in the component file.
Disabling sync should be used as a last resort when you need to change the core behavior of a component.
See our best practices for when to disable sync.