miracle2k/webassets — Issue #72: cssrewrite and django.contrib.staticfiles
Author: AdrianRibao
Created: 2011-10-13 16:53:23+00:00
State: open

I have the file main.scss in the directory: templates/static/css/sass/main.scss and the staticfiles build all the staticfiles to /static

There is a file under: /templates/static/graphics/logo.png

inside main.scss there is the following rule:

#header{
background:transparent url(../../graphics/logo.png) no-repeat scroll 0 0;
}

Using the rebuild command, the main.css file is compiled into /static, so /static/main.css looks like:

....
#header{
background: transparent url(templates/static/graphics/logo.png) no-repeat scroll 0 0;
}
....

The problem here looks like the css rewrite is not taking into account the STATIC_ROOT, that should be removed from the final path.

The result is:

templates/static/graphics/logo.png
and should be:

graphics/logo.png

The asset:

compass = Bundle('css/sass/main.scss',
filters='compass,cssrewrite',
output='main_debug.css',
debug=False,)

Regards,

Adrián.