Manual
Subframe works with any framework that uses Typescript, React, and Tailwind CSS.
This guide will walk through all of the steps needed to get Subframe working in your codebase.
For this example, we’ll assume you have a project with the following file structure:
Set up Tailwind CSS
You can find more information on how to set up Tailwind CSS in the official Tailwind CSS documentation.
First, install Tailwind CSS, PostCSS and Autoprefixer in your project.
Next, initialize your Tailwind CSS config:
This will create a tailwind.config.js
file in your project root.
The file structure should now look like this:
Update the tailwind.config.js
file to include the src
directory and any files we might use Tailwind CSS in.
We’re assuming you’ll sync your Subframe projects to somewhere inside your src/
directory. If not, you’ll need to adjust the content
array in your tailwind.config.js
file accordingly.
Finally, to include Tailwind CSS in your CSS, add the following to your src/styles.css
file:
And include ‘styles.css’ in your App:
Install Subframe
We strongly recommend using @subframe/cli
to initialize your project. If for some reason that’s not possible or you are troubleshooting issues, you can follow the steps below.
Create a .subframe/sync.json
file
This file contains Subframe configuration settings that are used when syncing components.
You can find your project ID in your URL in the Subframe app: https://app.subframe.com/<YOUR_PROJECT_ID>/playground
.
Install the necessary dependencies
Subframe depends on @subframe/core
. Run the following command to install the dependencies:
Include Subframe’s preset in your Tailwind CSS config
This will ensure that the theme you setup in Subframe applies to your app.
Sync your Subframe components
Run the following command to download your Subframe component code into your codebase:
The Subframe CLI will look for the project settings in your .subframe
directory and download the components accordingly.