Ask A Question

Notifications

You’re not receiving notifications from this thread.

Webpacker Javascript Embed Code Snippet & Scoped Styles Discussion

@Chris Oliver, Nice series tutorial. I really enjoy this series of tutorial.
If you have time and If you will convert this embeddable series with React JS then it would be nice. I like your tutorials and also I increase my skills through your tutorial.

Reply

I just notices a rails helper method for escaping the html on show.html.erb, :html_escape

example:

helper.send(:html_escape, 'is a > 0 & a < 10?')

It might be easier.

Reply

Wait, that might not work well.

Reply

skip_before_action :verify_authenticity_token is being used in comments controller - seems like a bad idea. how can we ensure csrf protection?

Reply

In case anyone else runs into this issue with Rails 6 and Webpacker, I needed to replace: sources_from_pack_manifest with sources_from_manifest_entries.

Reply

I just ran into that. The Rails error suggested the same thing.

Reply

How do you access stylesheets? There are only js files in sources_from_manifest_entries

Reply

You need to set extract_css to true in your webpacker.yml file.

Reply

If I am using TailwindCSS, how can I NOT send the entire library on embed.css endpoint?

Reply

Hello, if the widget have steps, like select a model and then enter user personal data, like email, name, etc. (in another view, like a 2 steps/views widget)How we accomplish this just making the steps inside the widget and not changing the current page?

Reply

Any idea how to parametrize the embedded javascript, say I want to retrieve a list of items through the embedded js. It's always the same piece of JS but sometimes I want to fetch based on some criteria. How would we achieve that ?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 78,890+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.