By including hyphens in your assign tag, you can strip the generated whitespace from the rendered template ... if you don't want any of your tags to output whitespace, as a general rule you can add hyphens to both sides of all your tags ({%- and -%}):
当我在 jekyll 中尝试时
{%- case key -%}
我收到错误
Error: Liquid syntax error (line 139): Tag '{%- case key -%}' was not
properly terminated with regexp: /\%\}/
jekyll 生成的 html 中有很多关于空格过多的帖子,例如 Compressing Liquid generated code .
他们都提示稀释了 HTML 输出并讨论插件作为解决方案。
我的简单问题是:
{%- ... -%}
无法在 jekyll 中工作? 最佳答案
Jekyll < v3.5.0 使用 Liquid v3.0.6。
空白控制仅在 Liquid v4 中可用,此版本将很快登陆 Jekyll。
截至 2017 年 6 月 18 日,Jekyll v3.5.0已升级到 Liquid v4。 {%- ... -%}
现在工作。
关于jekyll - jekyll 中的空白控制 - 为什么 {%- ... -%} a la liquid 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40451313/