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

Load extra JS scripts into flipper-ui #873

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicastelo
Copy link

Adds the ability to load extra JS scripts into flipper UI.

Added a new field scripts to lib/flipper/ui/configuration.rb so it allows to load scripts into the layout of flipper-ui.

Usage:

Flipper::UI.configure do |config|
  config.scripts << { src: "https://example.com/script.js" }
end

@jnunemaker
Copy link
Collaborator

@nicastelo hey! Looks good. I'm curious what the use case is. I'd love to know that prior to merging.

@nicastelo
Copy link
Author

@nicastelo hey! Looks good. I'm curious what the use case is. I'd love to know that prior to merging.

Thanks!

In my case, I wanted to load some extra content into the page, like a list of actors to select from. Apart from that, this feature could be useful for adding custom styles or have some company branding, like a logo. It can even be useful for tracking stuff on the frontend side if you wanted to.

Initially, I thought I could extend the ERB views but didn’t find an easy way to do so, apart from potentially monkey-patching and creating another set of views. With JS, I can simply load whatever content I want onto the page.

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.

None yet

2 participants