Try editing your project using Stackbit's Code Editor and your local code editor. View your changes instantly in Stackbit.
Edit the Code with Stackbit's Code Editor
The live preview in Stackbit is driven by the preview
branch. When you save your Stackbit Code Editor changes, Stackbit makes a commit to the preview
branch in Github.
- Click Code in the top nav.
- In the left panel, click Code Editor.
- Under the
src/css
directory, open themain.scss
file. - Add
.text-green { color: #2ea44f; }
to the file. - Save your work (
command
+s
) and closemain.scss
. - Hover over the page title in the preview panel.
- Click Code in the bottom right of the highlight. This opens the
HeroSection.js
file and highlights theH1
code responsible for rendering the title. - Add
text-green
to theH1
's className. - Save your work and watch the color of the title update.
Edit the Code with Your Local Code Editor
Now let's edit the preview
branch from your local development environment. After we commit the changes, we'll see it update in Stackbit.
Clone the repo to your local IDE
Open your local machine's command prompt and execute the following three commands, substituting your GitHub username for
YOUR_USERNAME
:git clone https://YOUR_USERNAME@github.com/YOUR_USERNAME/my-first-site.git cd my-first-site git checkout preview
Change the title's color
- Open the
my-first-site
directory in your local development editor. - Click the
src
directory. Then thecss
directory. Then open themain.css
file. - Add
.text-purple { color: #800080; }
to the file. Save it. - Click the
components
directory. The open theHeroSection.js
file. - In
HeroSection.js
addtext-green
to theH1
's className. Save it.
Push your local work to the Github
In your command prompt, execute the following three commands:
git add --all git commit -m "Color change" git push
- Navigate back to Stackbit. Close the Settings modal.
- Watch the color of the title change to purple.
- Previous Step: Instant Content Sync
- Next Step: Drag-and-Drop Components