can't we add some custom helper to use in css.erb files
we try to put some methods to Helpers/application_helper but they are not accesible from css.erb... in template output <%= myHelperMethod() %>
we add the "helper :all" in application_controller ... but no lucky!!
The helper and their methods are not accesible from css.erb
ActionView::Helper classes are generally only available to users of ActionView like app/views/
My thought is that you would be better off putting your methods in a lib/ module and including that module inside the css.erb file. I'm guessing you could also include ActionView::Helpers inside the css.erb file...
Try including your helper module in Sprockets::Context:
Hi Guille ...
As initializer or in application.rb??
@daniel2d2art try as initializer
@daniel2d2art this still being an issue for you?
No, I work arround templating directly to css, that is what I wanted to avoid. But in any case is another way to solve.
closing issue ...
Here a solution :
Create a config/initializers/sprockets_helpers.rb file
With this content :
# Support all ActionView goodness in asset files with *.erb extension
# More info at : https://github.com/rails/rails/issues/3116 and https://github.com/sstephenson/sprockets/issues/218