LoginSignup
0
0

More than 1 year has passed since last update.

ソースコードの圧縮

Posted at

HTMLはmacroで圧縮可能だがrequire cssで{{ standard_header_includes }} に出力されるcssは圧縮できない可能性が高い

下記の場合の結果

・HTML部分のみ1行に圧縮される。
・CSSは複数行で出力される

{%- macro func_compress() -%}
<p>
  圧縮したいHTMLタグとテキストが入ります
</p>

{% require_css %}
<style>
  .test {
    background-color: red;
    color: red;
    border-color: red;
  }
</style>
{% end_require_css %}
{%- endmacro -%}
{{ func_compress()|cut('\n')|regex_replace(' {2,}', ' ') }}
0
0
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
0
0