jekyll - jekyll 中的空白控制 - 为什么 {%- ... -%} a la liquid 不起作用?

标签 jekyll liquid

liquid documentation指出

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 的行为与液体文档建议的不同
  • 最佳答案

    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/

    相关文章:

    jekyll - 对于Liquid中的循环:与limit:1结合使用

    ruby - 液体模板贴图过滤器

    css - 本地主机和 github 页面之间的 Jekyll 字体不同

    filter - 使用液体按字母顺序对帖子进行排序

    css - Jekyll 页面特定 CSS

    Jekyll 和嵌套列表的 YAML 前端内容

    javascript - 如何在特定的 jekyll 帖子中使用 javascript?

    javascript - 将 SMINT v3.0 添加到 Shopify

    ruby - 来自 Shopify Liquid 的 API 调用

    html - Div 2 Column Set Set using images and block-links inline-block 不起作用 - Shopify/liquid