我想做这样的事情:
{% assign newline = "\n" %}
newline = '{{xxxx}}'
但这返回的输出为:
newline = '\n'
我期望输出为:
newline = '
'
最佳答案
恐怕你不能使用“\n”,它是一个正则表达式片段,无法被常规 Jekyll 过滤器解析。
但是你可以找到另一种方法。
压缩CSS
您可以使用 native Jekyll sass 转换器。
将 _includes/css/styles.css 重命名为 css/styles.scss
为其添加标题
--- # this yaml front matter, even empty, forces Jekyll to parse sass or scss # you can put plain css in this file, it will simply benefit from # compression functionalities --- html,body,div,span ....
在 _config.yml 中配置 sass 行为
sass: # style : nested (default), compact, compressed, expanded # :nested, :compact, :compressed, :expanded also works # see http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style # on a typical twitter bootstrap stats are : # nested 138,7kB, compact 129,1kB, expanded 135,9 kB, compressed 122,4 kB style: compressed
压缩html
您只需使用 imathis html minification plugin .
然后,您将需要使用不同的工作流程将源代码发布到 Github 页面。
您可以在 Octopress Rakefile 中找到有用的灵感或者在我的works on versioning workflows适用于使用插件的网站。
关于html - 如何在 Liquid 模板中声明换行符变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25815329/