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

Where are imports searched for? #6

Open
WhyNotHugo opened this issue May 30, 2020 · 5 comments
Open

Where are imports searched for? #6

WhyNotHugo opened this issue May 30, 2020 · 5 comments

Comments

@WhyNotHugo
Copy link

WhyNotHugo commented May 30, 2020

I've a scss file (site.scss) with a few imports at the top:

@import "site";
@import "shared";

html {
...

This file is inside one of my django app's static/js directory. site.scss is inside my app's static/js.

(My main SCSS file uses a few variables that are set inside other apps, and this is because the main SCSS file is shared across many sites).

This worked with django-sass-processor, but since I'm using django-compressor, I really want to move to libsasscompiler. However, I'm getting this error:

sass.CompileError: Error: File to import not found or unreadable: site.
        on line 1:1 of idf/core/static/www/v2.scss
>> @import "site";

   ^

What's the search criteria when looking for imports? Any hints on how to work around this?

@sonic182
Copy link
Owner

This package relies on sass.compile method from libsass package, and the "Compiler base" from django-pipeline, here is all the logic of this package

But I think you have to use relative imports (relative to the file importing your base style)

@WhyNotHugo
Copy link
Author

Hmmm... I'm not sure how I can achieve that; I'm importing from a scss provided by another django app, so the paths are not relative in filesystem terms, but they are relative from django's finders' point of view.

@sonic182
Copy link
Owner

Absolute imports then? The problem is that there is not built in stuff in libass for doing that, yes, it could be interesting to do it here

@sonic182 sonic182 reopened this May 31, 2020
@WhyNotHugo
Copy link
Author

Hmm... Can a "search path" be passed to libsass for relative imports?
If so, passing the static directory of all the apps in INSTALLED_APPS might be simple and make sense.

@WhyNotHugo
Copy link
Author

Hmm... looks like it's only possible with compile_dir, and not with compile. :/

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