Migrate hello-world-astro-devlink to DevLink v2 export#1
Conversation
| "js": "jsx" | ||
| } | ||
| "devlink-export": { | ||
| "rootDir": "./src/webflow", |
There was a problem hiding this comment.
I think the paths in Layout.astro are pointed to ./webflow, not ./src/webflow, so this might need to change if the CLI follows this setting when exporting.
…nk features - Updated webflow.json to adjust root directory and add telemetry settings. - Refactored index.astro to replace webflow component imports with standard HTML elements. - Introduced new DevLinkProvider and IX3Provider components for improved interactions. - Added utility functions and styles for better component integration. - Created new CSS files for global styles, variables, and normalization.
- Removed options object from the anchor tag in index.astro for cleaner code. - Directly set the href attribute for improved readability.
- Deleted telemetry section from webflow.json for a cleaner configuration. - Ensured the file maintains proper structure and formatting.
… setting - Removed the treeShake setting from webflow.json for a more streamlined configuration. - Maintained the overall structure and formatting of the file.
- Added detailed steps for installing and configuring the Webflow CLI. - Included commands for logging in, installing dependencies, and syncing Webflow components. - Provided a link to the DevLink documentation for further reference.
- Deleted unused CSS files related to the previous DevLink configuration. - Updated the DEVLINK_SCOPE_CLASS in devlinkScope.js to use a placeholder for site ID. - Cleaned up global CSS imports to reflect the removal of obsolete styles.
Astro hydrates the React DevLinkProvider client-side (client:load), so its useInjectFonts hook only runs after first paint. For Google fonts referenced by exported DevLink components to be available on the initial server-rendered HTML, the layout needs to emit DevLinkFontTags statically in <head>. Mirrors the approach Paul Moreau is taking in #1.
|
@paulvmoreau-webflow can you point this PR to v1 |
- Eliminated the DEVLINK_SCOPE_CLASS import and its application to the <html> tag. - This change simplifies the layout structure while maintaining the necessary Webflow styles through global CSS.
| --- | ||
|
|
||
| <!doctype html> | ||
| <html lang="en" class={DEVLINK_SCOPE_CLASS}> |
There was a problem hiding this comment.
You don't need to set this scope class directly. Imported components will be wrapped in the scope class automatically.
If we put the scope class at the top level DOM then we run the risk of Webflow CSS style blocks bleeding over into the end user's app.
| @@ -0,0 +1 @@ | |||
|
|
|||
There was a problem hiding this comment.
For now, this will sit empty. It exists so that the layout imports work out of the box.
When an end user runs webflow devlink export will populate this file and others as needed.
- Deleted multiple unused files including DevLinkProvider, IX3Provider, and associated utility modules. - Cleaned up global CSS and font management components to streamline the project structure. - This removal enhances maintainability by eliminating legacy code and unused dependencies.
Changes
webflow.jsondevlinkwithdevlink-export./src/webflow(was./devlink)components/componentGroups:.*)ts: false)cssScopes: true) instead of CSS modulesrelativeHrefRootto/src/layouts/Layout.astroDevLinkProviderimport to../../webflow/DevLinkProvider../../webflow/css/global.cssDevLinkFontTagsfrom../../webflow/webflow_modules/DevLinkFontTagssrc/pages/index.astrodevlink/_Builtin/Basicimports with per-component imports fromwebflow_modules(Block,Container,Link,Section)Removed
devlinkconfig:cssModules,fileExtensions.js: "jsx"./devlinkanddevlink/_Builtinimport pathsTest plan
npm installand confirm the project buildsnpm run devand verify the app serves athttp://localhost:4321src/webflownpm run buildandnpm run previewto validate production output