express-cdn icon indicating copy to clipboard operation
express-cdn copied to clipboard

Working with html + swig?

Open gonzalodiaz opened this issue 11 years ago • 1 comments

Is this library able to work with html + swig instead of jade or ejs?

I had this code:

{% for cssFile in cssFiles %}<link rel="stylesheet" href="{{cssFile}}">
{% endfor %}

where cssFiles it is the list of Css Files stored as String in a config file.

I've change it to this:

    {% for cssFile in cssFiles %}
      <script type="text/javascript">
          var cssFileVal = "{{cssFile}}";
                  {{ CDN(cssFileVal) }}
      </script>
    {% endfor %}

But the code in {{}} is not pre processed, so I end having this:

{ "assets": cssFileVal }
                 ^
SyntaxError: Unexpected token c

I will really appreciate some help to make this work. Thanks

gonzalodiaz avatar Nov 11 '14 15:11 gonzalodiaz

This was a long time ago, but I wanted to comment that I do use SWIG with this just fine. Without running the code above, it looks like its a mistake in the code itself. It should be something like:

{% for cssFile in cssFiles %}
      {{ CDN(cssFileVal) }}
{% endfor %}

tsestrich avatar Jan 13 '16 14:01 tsestrich