HamlPy
HamlPy copied to clipboard
trouble with static tag
Hi!
First of all thanks for the HamlPy. Realy good tool. But I have a trouble with {% staic %} tag. I try to add style in base.haml template but it rise an exception. Current example work perfect:
%head %link{rel: "stylesheet", href: "/media/static/css/bootstrap.min.css" }
But when I try to use static tag i got fail :( %head %link{rel: "stylesheet", href: {% static "css/bootstrap.min.css" %} }
Maybe it would be better to provide in hamlpy some tags for current case. for example in hamlpy.templates.tags there were some tags like:
- style "css/bootstrap.min.css" which will render: < link rel="stylesheet" href="/media/static/css/bootstrap.min.css">
Of course it will be perfect if there is a JS tags in hamlpy tags.
Have a nice day!
Did you load the staticfiles
templatetags? You're also not putting quotes around your attribute names.
This works:
%link{rel: 'stylesheet', type: 'text/css', href: '{% static "css/grid.css" %}' }
Note the single quotes hiding the raw django template tag from haml.