energyui-storyblok-starter
-Repo by clicking on "Use this template"
-> "Create new repository".NPM_RC
with //<your package registry>:_authToken=<your npm token>
STORYBLOK_API_TOKEN
with a preview token from the cloned Stroyblok
Space above./preview/
as the path, e.g.
https://energyui-storyblok-starter.vercel.app/preview/
.See "Local Development"-Section below for the necessary steps to start developing locally with rapid feedback cycles.
You can use this button to deploy the EnergyUI@Storyblok starter repo on Vercel. Feel free to change the repository URL for quicker deployment of the clone repository:
npm
: Ensure you're using the correct Node version 18+ locally; nvs use
, nvm use
for automatic selection, if you use one of those tools.mkcert
: for local setup, to get a locally trusted SSL certificate... needed to run inside the Visual Editor iframe of app.storyblok.com
npm i
to install dependencies.env.local.sample
to .env.local
, and replace all placeholders:
NEXT_STORYBLOK_SPACE_ID
) in your Storyblok Spaces "Settings", on the initially opened page (called "Space"). Make sure to exclude(!) the #
sign in front of it (297364
instead of #297364
)NEXT_STORYBLOK_API_TOKEN
) in those same "Settings", but in the sub page called "Access Tokens". You can just use the initially created Preview
-Token (just copy it using the handy icon)NEXT_STORYBLOK_OAUTH_TOKEN
) needs to be created in your "My account" settings, just follow this guide: https://www.storyblok.com/docs/api/management/getting-started/authenticationnpm run storyblok-logout
followed by npm run storyblok-login
. The logout first ensures the CLI can actually see all projects, especially newly created ones (which would be likely for a starter like this) can error out otherwise. Use your Storyblok-Login and the region chosen when creating your Space herenpm run init
. This removes demo content, adds all the needed preset and demo content images (into distinct folders, as not to pollute your future project), all components and preset configuration, and creates an initial demo page.env
(variable NEXT_PUBLIC_SITE_URL
)git add --all && git commit -m "Initial Storyblok setup" && git push origin main
):
cms/components.123456.json
is the automatically generated component schema, which was already part of the repository when forked (you can regenerate it with npm run create-storyblok-config
). It now includes the correct asset references for visual component previewscms/presets.123456.json
is the same for presets, now with updated asset references for visual preset previews and correct space and component id referencestypes/components-schema.json
is your live component schema pulled from Storyblok (seeded by cms/components.123456.json
, this now includes all correct ids and references, pulled by npm run pull-content-schema
)types/components-presets.json
again is the same for presetstypes/components-schema.d.ts
includes TypeScript types matching your content and component schemas. This is generated based off your components-schema.json
by using https://github.com/dohomi/storyblok-generate-ts.env
containing general project related configurationTODO add note somewhere about server start being bound to getting-started
existing. If that page is renamed / deleted, you need to adjust the script dev:proxy
in package.json
accordingly.
mkcert localhost
. This generates local key and cert files used when starting the local server (you don't commit those, which is why they're on the .gitignore
)npm run build
npm run dev
https://localhost:3010/api/preview/
TODO: check initial npm run init
locally again... failed for push-components
in initial try, because of missing environment variable NEXT_STORYBLOK_SPACE_ID
in push-components
script
NEXT_STORYBLOK_API_TOKEN
: TODO don't repeat explanations, see local setup aboveNEXT_STORYBLOK_OAUTH_TOKEN
: TODO don't repeat explanations, see local setup aboveNEXT_STORYBLOK_SPACE_ID
: TODO don't repeat explanations, see local setup aboveSTORYBLOK_LOGIN_EMAIL
: the email for the account you created the Space withSTORYBLOK_REGION
: region your Space is hosted in. You should have selected this when creating itmain
as the branch to build fromFrom now on your build process in Netlify should be automatically triggered, deploying a new version of the site in the background, whenever an editor adds, deletes or changes a Story in Storyblok.
/api/preview
added to it (e.g. if your site URL happens to be https://storyblok.netlify.app
, the URL you'd enter would have to be https://storyblok.netlify.app/api/preview/
)// TODO use correct URL in non-premium starter
// TODO mention next local steps still needed (like npm run generate-content-types
)
/
?TODO
TODO
TODO
YOUR_WEBSITE
should be the path pointing to your website project, the one you want to update the previews for.
TODO adjust this to ds-agency
on non-premium version
nvs use
, nvm use
for automatic selection, if you use one of those tools):
yarn
to install dependenciesrm -rf src/token
to remove the existing default themecp -r YOUR_WEBSITE/token src/token
to copy your Design Token / Style Dictionary configuration to the Design System projectbackground-color
for the .preview--wrapper
CSS class in global.scss
, to a color suitable for your component screenshots (depends on your applied design)
index.scss
, you should add an import to the file .storybook/preview.tsx
(e.g. right after the already existing import "./preview.css";
): import YOUR_WEBSITE/index.scss
fonts.scss
accordingly (if not done already). Finally uncomment the font import in index.scss
temporarily, to include the correct fonts in preview generation. Fonts are normally loaded by Next.js, which is missing when building from Storybook.yarn build-storybook
to build a Storybook that can then be used to create screenshotsyarn create-component-previews
to re-create the existing previews with your brandingmkdir -p YOUR_WEBSITE/public/img && rm -rf YOUR_WEBSITE/public/img/screenshots && cp -r static/img/screenshots YOUR_WEBSITE/public/img/
to copy the generated screenshots to your projectcd YOUR_WEBSITE
to switch to your website projectnpm run update-previews
to update those newly created screenshots in your Storyblok space (can take 2-3 mins)Reminder: Undo the import for fonts.scss
in index.scss
if you had to change that for your previews, otherwise you'd load redundant fonts on your page later.
Generate ts types according to the content schema by running
NEXT_STORYBLOK_SPACE_ID=<your-space-id> npm run generate-content-types
.
When changing the content schema we recommend sticking to Storyblok's Best Practices.
Contributions are welcome. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
This project is licensed under either of
at your option.
The SPDX license identifier for this project is MIT OR Apache-2.0.
For more information and updates, please visit the project's GitHub repository.
Join our Discord community for support, or leave an issue on this repository!