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

Sass sourcemap #919

Closed
camilonova opened this issue Oct 1, 2018 · 7 comments
Closed

Sass sourcemap #919

camilonova opened this issue Oct 1, 2018 · 7 comments
Labels

Comments

@camilonova
Copy link
Contributor

Hi, I have this setting:

COMPRESS_PRECOMPILERS = (
   ('text/x-sass', 'sassc -m auto {infile} {outfile}'),
)

It generates correctly the sass file but the .map file is not generated.

If I change the setting to:

COMPRESS_PRECOMPILERS = (
   ('text/x-sass', 'sassc -m inline {infile} {outfile}'),
)

It shows the sourcemap inside the sass file, which is ok, but the source file path is wrong, it is an absolute path instead of a relative path so it does not work propertly.

Any ideas how to fix/solve that?

@karyon
Copy link
Contributor

karyon commented Oct 3, 2018

hm, that seems to be a problem of sassc, which i don't know at all. or what do you think how django-compressor could solve this?

@camilonova
Copy link
Contributor Author

If I run the same command directly into the shell it generates the file correctly.

Can you explain me how the precompilers commands are run?

@karyon
Copy link
Contributor

karyon commented Oct 7, 2018

no, sorry. but maybe the CssAbsoluteFilter is the problem? you could try using the CssRelativeFilter instead.

@camilonova
Copy link
Contributor Author

I tried but gives the same results, at the end of the css file shows /*# sourceMappingURL=tmp8w4nfn41.css.map */ which seems like the wrong file name and also at the same directory the file does not exists.

@karyon
Copy link
Contributor

karyon commented Oct 9, 2018

alright, then i'm out of ideas and this would require some debugging. feel free to do that, ping me if you need anything, although i don't know the code much better than you do ;)

@jrief
Copy link
Contributor

jrief commented Oct 10, 2018

@camilonova Even though it's not related to this problem, have a look at https://github.com/jrief/django-sass-processor

This app generates *.css.map files on the fly and works well together with django-compressor. However, it compiles the files, before django-compressor steps in.

Disclaimer: I'm the author of that library.

@karyon karyon added the bug label Apr 7, 2019
@camilonova
Copy link
Contributor Author

You should use:

sass --embed-source-map {infile} {outfile}

This will include the source map into the outfile and fixes this issue.

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

No branches or pull requests

3 participants