Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript interop #4

Merged
merged 3 commits into from
May 3, 2024
Merged

Conversation

C-Sinclair
Copy link
Contributor

@C-Sinclair C-Sinclair commented May 2, 2024

Changes

This PR adds capability for Javascript hooks to be added to components, and installed alongside Elixir component templates.

Implementation details

Javascript hooks are authored in the assets/js/ folder, and are moved alongside the .ex templates when mix bloom.generate_templates is run. Then on mix bloom.install X the JS file is added to assets/js/vendor/hooks/X.js

Just like the Elixir components, it is then up to the consumer of the package to wire up the hook ready for use.

Note

I opted for a basic npm init to get the types in place for more complex hooks, and Javascript tooling to be added later.
If you have strong preference for either yarn or pnpm (or bun) then I'm happy to switch that out

Testing

See a new component with hook implemented in #5

Copy link
Owner

@chrisgreg chrisgreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

@chrisgreg chrisgreg merged commit d90fae5 into chrisgreg:main May 3, 2024
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