Open bertBruynooghe opened 2 years ago
I think we should simply update doc on https://github.com/usabilityhub/rails-erb-loader#dependencies
for this special case.
I have never used rails-erb-loader-dependencies
in .html.erb
so I have no idea that syntax is required.
(I don't even know how it works and I have only contributed a few things 😆 )
If you don't want the directive to end up in the result, or wish to use it outside of a javascript context, include the javascript comment block inside an erb comment block.
The reason this was not included in the docs is because comments should be removed in minification in your release build (same goes for all preprocessor directive comments, eslint etc etc)
I spent quite some time figuring out I needed the following syntax to get dependencies detected for my
.html.erb
files:I see two solutions:
/* rails-erb-loader-dependencies ... */
implement searching for:rails-erb-loader-dependencies
(which allows users to use the proper comment syntax for the resulting file, and which is backwards compatible)It would also be fine if we could support
<%# rails-erb-loader-dependencies ... %>
, which leaves no traces in the end result, and would also work for stuff that doesn't support comments (e.g..json.erb
)I am willing to create a PR for this if you decide which of the two solutions you prefer...