V
V
VostokSisters2017-01-21 10:59:54
Pug
VostokSisters, 2017-01-21 10:59:54

How to make multiline non-compiled text in tag attributes in pug (jade)?

There is such a code in jade (pug):

body(
  |{% case page.url %}
  | {% when '/' %}
  |    class="hellopage"
  | {% when page.url contains '/gallery/' %}
  |    class="gallerypage"
  |{% endcase %}
  )

All {% .. %} are Liquid stuff, so don't compile them with Jade, use |.
Naturally, the compiler does not understand this format (I use gulp-jade), what can you advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mrSand, 2017-09-13
@mrSand

copy-paste from offsite
If your inline tags don't require many attributes, you may find it easiest to use tag interpolation, or literal HTML, within a plain text block.

p.
  Using regular tags can help keep your lines short,
  but interpolated tags may be easier to #[em visualize]
  whether the tags and text are whitespace-separated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question