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

Multiple processors #711

Open
brandoncc opened this issue Jun 22, 2021 · 0 comments
Open

Multiple processors #711

brandoncc opened this issue Jun 22, 2021 · 0 comments

Comments

@brandoncc
Copy link

I am upgrading to sprockets 4 and I have some .js.erb files. I have read the extending sprockets guide a few times and I can't figure out how to make my files compile properly. I realize they have to be named .js now, but I don't know how to make the ERB code parse.

I have a file that starts like this:

$(function () {
  var activeDotImgSrc =
    '<%= image_path("home/collaboration-steps-nav-dot-active.svg") %>';
  var inactiveDotImgSrc =
    '<%= image_path("home/collaboration-steps-nav-dot-inactive.svg") %>';

I need these image paths in my javascript. How can I achieve this?

I have another file that has a condition of Rails.env in a .js.erb which I need as well.

The readme has documentation for depend_on which looks like:

//= depend_on "bar.data"

var bar = '<%= File.read("bar.data") %>'

Based on this, it must be possible?

Thanks in advance.

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

No branches or pull requests

1 participant