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

Directives in erb files ignore subdependencies since Sprockets 4 #470

Open
GCorbel opened this issue Jan 28, 2021 · 0 comments
Open

Directives in erb files ignore subdependencies since Sprockets 4 #470

GCorbel opened this issue Jan 28, 2021 · 0 comments

Comments

@GCorbel
Copy link

GCorbel commented Jan 28, 2021

I recently updated the version of Sprockets from version 3.7.2 to 4.0.2. When I have those files :

//dep.js
//= require subdep.js
//subdep.js
console.log('something')
//main_test.js.erb
/*
 *= depend_on_asset "dep.js"
 */

<%= Rails.application.assets['dep.js'].source.html_safe %>

With Sprockets 3, when I edit subdep.js, the result rendered by main_test.js was updated. Since Sprockets 4, it isn't.

It works as expected if I change main_test.js.erb to call the ruby method like this :

//main_test.js.erb
<% depend_on_asset "dep.js" %>

<%= Rails.application.assets['dep.js'].source.html_safe %>

With directives Rails.application.assets.find_asset('main_test.js').metadata[:dependencies] doesn't include subdep.js and it is included when we call the ruby method.

I checked the sprockets source code, and it seems directives are correctly detected.

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