Using Django templates in CSS

Having code like this:

#selector {
    width: {{ constants.width }}px;
}

causes PyCharm to raise error warnins "} expected" on the first line of the code above and a whole mess of errors on the second one.

Seems like this is because of closing "}" in variable template.

In PhpStorm this can be solved by making all files with ".css" extension to be regarded as PHP files and then changing "Template data language" setting to "CSS". How can I do something like this in PyCharm?

1 comment

Hello Andrei,

Currently the set of file types considered to be Django templates is hard-coded

in PyCharm. Please file a feature request in YouTrack to add an option for

treating .css files as Django templates.

Having code like this:

#selector {

width: {{ constants.width }}px;

}

causes PyCharm to raise error warnins "} expected" on the first line

of the code above and a whole mess of errors on the second one.

Seems like this is because of closing "}" in variable template.

In PhpStorm this can be solved by making all files with ".css"

extension to be regarded as PHP files and then changing "Template data

language" setting to "CSS". How can I do something like this in

PyCharm?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

Please sign in to leave a comment.