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

Bundle for Production, Dev-Builds and prebuilt JavaScript with the gem #575

Merged
merged 22 commits into from
Apr 1, 2022

Conversation

marcoroth
Copy link
Member

@marcoroth marcoroth commented Mar 15, 2022

Type of PR

Enhancement

Description

This PR

Why should this be added

  • This brings the bundling in-line with CableReady
  • Eases the support for us to support all the different JavaScript/assets pipelines that come with Rails 6/7
  • Bundles the JavaScript packages upfront so it's more compatible for setups where no build-pipeline is used
  • Prepares a future where the stimulus_reflex gem also ships a pre-built JavaScript dist file
  • Switches the internal dependency from stimulus to @hotwired/stimulus
  • Also introduces dev-builds for StimulusReflex via https://github.com/stimulusreflex/dev-builds
  • Rewrites the JavaScript test suite to @web/test-runner
  • Bundles the pre-built JavaScript client with the Rubygem

JavaScript Client:

This enables Rails Applications to easily include the StimulusReflex JavaScript client into their app by just installing the stimulus_reflex Rubygem.

# Gemfile

gem 'stimulus_reflex', '~> 3.5'

Either with Import maps:

# config/importmap.rb

# ...

pin 'stimulus_reflex', to: 'stimulus_reflex.min.js', preload: true

Or with the regular Asset pipeline:

<!-- app/views/layouts/application.html.erb -->

<%= javascript_include_tag "stimulus_reflex.umd.min.js", "data-turbo-track": "reload" %>

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing
  • This is not a documentation update

@leastbad
Copy link
Contributor

I suppose that reality of the longer than anticipated release cycle is that it's harder and harder to justify waiting until a future v4 to switch to @hotwired/stimulus.

@leastbad
Copy link
Contributor

If it's still possible to consider releasing an officially blessed alternative package that imports from stimulus - something like stimulus_reflex-compat - I think that we should at least try to do so.

@marcoroth
Copy link
Member Author

@leastbad I don't think there is a need for it. It's just the internal dependency which is switched over. If you are still using stimulus in your app you don't even notice anything 🙂

@marcoroth marcoroth force-pushed the bundle-for-production branch from 82d77c2 to ce174f1 Compare March 16, 2022 22:51
@marcoroth marcoroth force-pushed the bundle-for-production branch from ce174f1 to bc74ac6 Compare March 16, 2022 22:52
@marcoroth marcoroth force-pushed the bundle-for-production branch 2 times, most recently from 84883d8 to 9398b82 Compare March 16, 2022 23:42
@marcoroth marcoroth force-pushed the bundle-for-production branch from 9398b82 to 18ef3f8 Compare March 17, 2022 08:31
@marcoroth marcoroth force-pushed the bundle-for-production branch from 18ef3f8 to fe71cde Compare March 17, 2022 13:29
@marcoroth marcoroth changed the title Bundle for Production and Dev-Builds Bundle for Production, Dev-Builds and prebuilt JavaScript with the gem Mar 17, 2022
@marcoroth marcoroth merged commit 945428c into stimulusreflex:master Apr 1, 2022
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