While searching for a solution to this issue, I have come up empty-handed using my usual Google search skills.
In my Rails 4 application, I am utilizing SASS for my CSS. I have dependencies on certain gems that contain CSS files which I must use. For instance, gem C has an index.css
file with Sprockets directives for its CSS. When I @import gem-x/index
in my application.css
, it just adds the text of those directives.
The only workaround I found is to inspect the source code of these external gems and manually @import
each CSS file individually, like so:
@import gem-x/file1
@import gem-x/file2
@import gem-x/file3
This manual process is tedious and requires knowledge of the assets structure for each external gem that doesn't offer direct SASS support.
Is there any way for Sprockets and the asset pipeline to process the index.css
files of these external gems when imported, rather than just dumping their contents into my application.css
?
Edit:
This behavior seems linked to a significant change in sass-rails
version 5 or higher: https://github.com/rails/sass-rails/issues/297
However, that discussion is quite dated now. Are there any current workarounds or solutions available?