feat: Use javascript_tag helper for vite_react_refresh_tag#372
Merged
ElMassimo merged 1 commit intoElMassimo:mainfrom Jun 19, 2023
Merged
Conversation
Owner
|
Looks great, thanks for your contribution Omar! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Use javascript_tag helper for vite_react_refresh_tag allowing h…tml_options
Description 📖
This pull request updated the
vite_react_refresh_tagmethod to use the Rails JavaScript helper methodjavascript_tagin order to support HTML options.Background 📜
This was happening because of #249. When adding Content Security Policy on a Rails project with something other than
unsafe-inlinethe inline JS for the react refresh script was not being allowed.The Fix 🔨
By changing the
vite_react_refresh_tagto use Rails'javascript_tagwe can now add HTML options such asnonce: true.The code adds the method
react_preamble_codewhich has the script for the React Refresh plugin.The
react_refresh_preambleis left unchanged with the exception of using thereact_preamble_codemethod internally inside its<script>...</script>tags.Screenshots 📷