Skip to content
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

Imports doesn't work on production #55

Open
mbajur opened this issue Jan 28, 2024 · 1 comment
Open

Imports doesn't work on production #55

mbajur opened this issue Jan 28, 2024 · 1 comment

Comments

@mbajur
Copy link

mbajur commented Jan 28, 2024

Hello,

i have a pretty basic dartsass-rails setup in place. To simplify things - let's say i have an application.scss file with @import 'notyf/notyf.min.css'; inside. While this notyf css file is being properly loaded in dev environment, after doing the release to production - it's not getting precompiled nor apparently even threat differently and precompiled application.css file still has a raw @import 'notyf/notyf.min.css'; line which tries to load this file - it doesn't exist in public folder which means styles are not loaded. Notyf is an external dependency i have defined in my package.json file.

Am i missing something in here? Is that possible to import external dependencies in assets precomiled with dartsass-rails ? Shouldn't dartsass-rails inject imported external stylesheets on precompilation? My dartsass initializer is:

Rails.application.config.dartsass.builds = {
  "." => "."
}

Thanks in advance!

@shawnmaust
Copy link

I ran into something similar recently and learned that if there's a .css at the end of the import name, Sass will treat it as a plain CSS @import and not try to import it when compiling.

https://sass-lang.com/documentation/at-rules/import/#plain-css-imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants