1
votes

I created a couple of email templates in jekyll. They consist of many parts like header, content, footer and blocks (logo, button, etc...). Now I need to compile it to one file with variables:

{% assign var1 = "var1" %}
{% assign var2 = "var2" %}

<!DOCTYPE html>
<html><head>
...
</head>
<body>
    <header>...</header
    <content>
        <div>{{ var1 }}</div>
        <div>{{ var2 }}</div>
    </content>
    <footer>...</footer>
</body>

It is necessary to insert one file into one of the email services (which supports liquid), setup liquid variables in the top of the file and send.

Jekyll compiles these many parts to one html-file, but it resolve variables too. So I can't get one html-file with liquid variables. Placeholders like {{ var1 }} will be replaced by value.

Is there a way to collect a single html-file from many parts but not replace variables by values?

1

1 Answers

1
votes

That is possible with {% raw %}, by doing this:

  • Search and replace {{ by {% raw %}{{
  • Search and replace }} by }}{% endraw %}
  • Compile/merge