2

I need to generate css based on client queries. I use the @import url() directive inside some style tags to call a method to produce a text string response of css. I can see the css is generated correctly in firebug, but it doesn't take effect.

If I serve the exact same css from my site media directory use the @import directive everything works fine.

my html header code:

<style type="text/css">
@import url("{{ css_url }}")
/*@import url("/site_media/css/style.css")*/
</style>

my django python code:

string = u'#exampleTextInput{ background-color:#ff0000;}\n'
return HttpResponse(string)
0

1 Answer 1

4

You probably need to set a Content-Type response header; that'd be my first guess:

string = u'#exampleTextInput{ background-color:#ff0000;}\n'
return HttpResponse(string, content_type='text/css')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.