LoginSignup
5
3

More than 5 years have passed since last update.

[pug] ダブルクオーテーション " が " になるのを防ぐなど、String Interpolation で変数を Unescaped にする方法

Posted at

pugのテンプレート内に変数を展開する String Interpolation で、エスケープさせる方法とさせない方法についての確認です。

ただ ドキュメント をちゃんと読めば済む話ですが、なかなかたどり着くことができなかったので、メモしておきます。

escapeする場合
- var hogeVar = "hoge";
script.
  const valEscaped = #{hogeVar};   // => "hoge"
escapeしない場合
   const valUnescaped = !{hogeVar}; // => "hoge"
5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3