Hi,
In my attempt to try to migrate away from SCSS, I ahve some files I need to import to my CSS from node_modules. I have added their paths to assets.rb like so:
Add additional assets to the asset load path.
Rails.application.config.assets.paths << Rails.root.join("app", "assets", "svg")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "reset-css", "reset-css")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "bourbon")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "@shoelace-style", "shoelace", "dist", "themes")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "photoswipe", "src", "css", "default-skin")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "flag-icons", "css")
Rails.application.config.assets.paths << Rails.root.join("node_modules", "animate.css")
and then referecning them from .css like:
@layer reset, imports, defaults, components;
@import url("/reset.css") layer(reset);
@import url("/light.css") layer(imports);
@import url("/flag-icons.css") layer(imports);
@import url("/animate.css") layer(imports);
But doing this makes the app super super slow to load. I see a white page and it just keeps loading. It does get there but it’s near impossible to develop with.
Ideally I think i’d prefer to have one like like Rails.application.config.assets.paths << Rails.root.join("node_modules")
in my assets file and then the rest of the path in the .css file but i’m unsure of the right way or if this will make things worse?
Any ideas how to avoid this? or fix it?