﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18050	CachedStaticFilesStorage eats @import statement	anonymous	nobody	"Input:
{{{
@import '../../3rdparty/pt-sans-generated/stylesheet.css';

html, body {
    padding: 0;
    margin: 0;
    background: transparent;
}
}}}

Output:
{{{
url(""../../3rdparty/pt-sans-generated/stylesheet.cc11c6fa559e.css"");

html, body {
    padding: 0;
    margin: 0;
    background: transparent;
}
}}}

Without @import statement!

Problem located in:
{{{
class CachedFilesMixin(object):
    patterns = (
        (""*.css"", (
            r""""""(url\(['""]{0,1}\s*(.*?)[""']{0,1}\))"""""",
            r""""""(@import\s*[""']\s*(.*?)[""'])"""""",
        )),
    )
}}}

last statement replace whole (@import…) construction with just url(). This quick fix solves a problem:

{{{
class FixedCachedFilesMixin(CachedFilesMixin):
    patterns = (
        (""*.css"", (
            r""""""(url\(['""]{0,1}\s*(.*?)[""']{0,1}\))"""""",
            r""""""@import\s*([""']\s*(.*?)[""'])"""""",
            )),
        )


class CachedStaticFilesStorage(CachedFilesMixin, StaticFilesStorage):
    """"""
    A static file system storage backend which also saves
    hashed copies of the files it saves.
    """"""
    pass
}}}

But it is definitely a serious bug because @import is completely broken by default. "	Bug	closed	contrib.staticfiles	1.4	Normal	fixed	CachedStaticFilesStorage css preprocessing @import		Accepted	0	0	0	0	0	0
