-
Notifications
You must be signed in to change notification settings - Fork 97
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
How to exclude assets from gems/engines? Known approach looks tedious or like a hack #89
Comments
Hi @tmaier , I saw something in turbo-rail repo like that (put in your application.rb for instance)
You could use the same approach for anything come from another gem. Kevyn |
Thanks @kevynlebouille, I think this does not work for Propshaft, as propshaft/lib/propshaft/railtie.rb Line 62 in a4ddf9a
|
May not be ideal, but I used this workaround: # config/initializers/assets.rb
Rails.application.config.after_initialize do |app|
app.config.assets.paths = %w(
app/assets/builds
app/assets/config
app/assets/images
)
end |
We are currently taking a look at how we handle paths due to a caching bug and will take a look at this after we handle that. |
Otherwise, propshaft will include all stylesheets in public/assets, even though they are already compiled inside of application.css. This is a known bug: rails/propshaft#89
I want to exclude all assets I am not using from precompiling.
I understand that
config.assets.excluded_paths
exists and that it requires a full path.In my case
Rails.application.config.assets.paths
returnsI would like to exclude most of them, e.g.
"/usr/local/bundle/gems/nested_form-0.3.2/vendor/assets/javascripts"
or"/usr/local/bundle/gems/actionview-7.0.2.3/lib/assets/compiled"
.I have two reasons for this: It takes comparatively long (e.g. assets from
heroicon
), I don't like to waste space (I know, it is not too much) and I like to have a clean directory with only the files I really use.This is the only way I found to do so:
Note: I am unable to use this methodology to exclude
actionview
oractioncable
.Pathname.new(Gem.find_files_from_load_path('whaever').first)
does not look like a good solutionWhat is the recommended way?
How can this be simplified?
The text was updated successfully, but these errors were encountered: