Skip to content

Initial attempt at outputting as Web Components#232

Open
radishmouse wants to merge 1 commit intomainfrom
feat/50-static-export
Open

Initial attempt at outputting as Web Components#232
radishmouse wants to merge 1 commit intomainfrom
feat/50-static-export

Conversation

@radishmouse
Copy link
Contributor

Description of the Change

Adds a separate configuration and build command for outputting specific Vue components as Web Components.

Running npm run build:ce ("ce" for "Custom Elements") produces two files that can be included in a static website:

  • dist/boltweb.iife.js
  • dist/boltweb.css

Example usage:

<bolt-primary-button
      variant="outline"
      href="{{ url('roadmaps.desktop') }}">
hey
</bolt-primary-button>

In this initial experiment, only exporting PrimaryButton.vue.

Benefits

This would allow us to have a single source of truth for styled UI elements.

Screenshots

image

Known issues / things to improve

The definitions of the Web Components live in a JavaScript file. This may not be ideal for all sites.

Notes

In order to display the text content between the opening/closing tags, had to modify PrimaryButton to show a default slot, not just named ones.

Tested locally in Storybook to confirm that this did not negatively impact the Vue component.

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.

1 participant