Skip to content

CLD-1736: Replace DevLink _Builtin imports with native HTML#2

Merged
fbaralle merged 6 commits into
v1from
cld-1736-remove-devlink-component-imports
May 18, 2026
Merged

CLD-1736: Replace DevLink _Builtin imports with native HTML#2
fbaralle merged 6 commits into
v1from
cld-1736-remove-devlink-component-imports

Conversation

@fbaralle
Copy link
Copy Markdown
Collaborator

Summary

src/pages/index.astro imported Section, Container, Block, and Link from ../../devlink/_Builtin/Basic. Those files are user-generated by the DevLink export (which now runs automatically after init), so a fresh clone fails to build until the export has run. This PR replaces the component usage with native HTML so the homepage renders independently of the DevLink output.

Mirrors the equivalent change in:

Changes

  • src/pages/index.astro — replaced <Section>/<Container>/<Block>/<Link> with native <section>/<div>/<a>. Styles kept in the existing <style> block (more idiomatic for Astro than inline style objects). Dropped client:load (no longer needed). Updated the docs URL to /data-clients/docs/getting-started. Added a comment hint for users on how to import DevLink components from ../../devlink/* once needed.

Intentionally unchanged

  • src/layouts/Layout.astro — still imports DevLinkProvider and ../../devlink/global.css. Those resolve correctly because the DevLink export runs automatically after init, populating ./devlink. The provider keeps wrapping <slot /> so DevLink components dropped into pages work without extra wiring.

Linked ticket

CLD-1736

Test plan

  • npm install && npm run build succeeds on a fresh clone (after auto DevLink export)
  • Homepage renders the gradient hero and "Get Started" button correctly
  • DevLink components imported into pages still render via the DevLinkProvider in Layout.astro

🤖 Generated with Claude Code

The homepage in src/pages/index.astro imported Section, Container, Block,
and Link from ../../devlink/_Builtin/Basic. Those files are user-generated
by the DevLink export (which runs automatically after init), so a fresh
clone failed to build. This swap to native section/div/a elements lets
the project build out of the box, with styles kept in the existing
<style> block.

Layout.astro still imports DevLinkProvider and global.css from the
devlink directory — those resolve correctly once the auto-run export
populates ./devlink. Mirrors the equivalent change to the Next.js scaffold
in webflow/webflow-cli#589 and Webflow-Examples/hello-world-nextjs-devlink#2.

Also updated the docs link to /data-clients/docs/getting-started.
fbaralle added 5 commits May 18, 2026 16:57
webflow.json's active config is `devlink-export.rootDir: "./webflow"`, so
the export populates ./webflow/ (project root), not ./devlink/. The
legacy `devlink` block is unused. Update Layout.astro to import from the
correct path:

- DevLinkProvider: ../../webflow/DevLinkProvider
- global.css: ../../webflow/css/global.css

Also update the example-import hint in index.astro to match.
Drops the <style> block and inlines the equivalent styles directly on
the section, heading, paragraph, and link elements. Matches the inline-
style convention used for the same fix in hello-world-nextjs-devlink#2.
The exported global.css wraps every rule in @scope (.wf-devlink-<hash>),
so without an ancestor carrying that class, normalize and Webflow
defaults never match. DevLinkProvider is a React Context provider and
doesn't render any DOM wrapper, so the scope class was effectively
unreachable for native HTML in the page.

Imports DEVLINK_SCOPE_CLASS from the generated webflow/devlinkScope.ts
and applies it to <body>, so Webflow's normalize + defaults now cover
the whole page (including native HTML elements). The constant updates
automatically on each re-export, so the hash stays in sync.
CSS @scope matches descendants of the scope-root, not the scope-root
itself. With the class on <body>, rules like `body { background-color }`
inside @scope (.wf-devlink-<hash>) never matched body (body IS the
scope-root) — so body-level Webflow defaults (background, font-family,
font-size, color) never applied.

Moving the class to <html> makes body a descendant of the scope-root,
so all body and below selectors inside the scope now match. Verified
locally: `body` now picks up Arial 14px / #333 / #fff background from
defaults.css.
Mirrors the dark-mode handling in the Next.js scaffold's globals.css.
Without this, body falls back to Webflow defaults (background #fff,
color #333) even when the OS is in dark mode, so the page stays light
while the Next.js sibling switches to a dark background.

Adds --background / --foreground custom properties on :root with a
prefers-color-scheme: dark override, and applies them to body.
@fbaralle fbaralle merged commit 48e52fb into v1 May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants