HamlPy icon indicating copy to clipboard operation
HamlPy copied to clipboard

trouble with static tag

Open NikolayGalkin opened this issue 11 years ago • 2 comments

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!

NikolayGalkin avatar Mar 01 '13 19:03 NikolayGalkin

Did you load the staticfiles templatetags? You're also not putting quotes around your attribute names.

kevinastone avatar Apr 16 '13 18:04 kevinastone

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.

hiway avatar Nov 26 '13 14:11 hiway