Jekyll:指定插件是否在开发环境中处于活动状态
Jekyll: Specify whether a plugin is active in the development environment
在我的 Jekyll 站点中,我使用 minify-html
plugin. However, it causes the site build time to increase from 2-20 seconds to nearly 5 minutes, which is unacceptable during development. According to the documentation:
After installing, Jekyll's HTML output will be minified by default. If you configure env
in your Jekyll configuration, HTML will be minified only when
env
is set to production.
env: production
此文档毫无用处,因为它没有解释如何 配置env
。正如所料,在 _config.yml
中设置 env: production
没有效果,因为它没有指定 什么 应该因环境而异。我花了很多时间在互联网上搜索如何进行这项工作,但我什么也没找到。据我所知,env
以及任何其他因环境而异的方法在 Jekyll 中完全没有记录。
如何在调用JEKYLL_ENV=production jekyll build
时将minify-html
设置为仅运行?
PS:如果相关,我通过将其添加到我的 Gemfile 和 运行ning bundle
.
安装了 minify-html
在`_config.yml``=> 缩小
中未设置 env
变量
env: production
=> 缩小
env: yolo or whatever or dev
=> 没有缩小
您可以有一个开发命令,使用将覆盖默认设置的开发配置文件 _config.yml
。 See command options
在新的_config_dev.yml中,设置:
env: dev
提供缩小版:jekyll serve
。
未缩小的服务:jekyll serve --config _config.yml,_config_dev.yml
在我的 Jekyll 站点中,我使用 minify-html
plugin. However, it causes the site build time to increase from 2-20 seconds to nearly 5 minutes, which is unacceptable during development. According to the documentation:
After installing, Jekyll's HTML output will be minified by default. If you configure
env
in your Jekyll configuration, HTML will be minified only whenenv
is set to production.env: production
此文档毫无用处,因为它没有解释如何 配置env
。正如所料,在 _config.yml
中设置 env: production
没有效果,因为它没有指定 什么 应该因环境而异。我花了很多时间在互联网上搜索如何进行这项工作,但我什么也没找到。据我所知,env
以及任何其他因环境而异的方法在 Jekyll 中完全没有记录。
如何在调用JEKYLL_ENV=production jekyll build
时将minify-html
设置为仅运行?
PS:如果相关,我通过将其添加到我的 Gemfile 和 运行ning bundle
.
minify-html
在`_config.yml``=> 缩小
中未设置env
变量
env: production
=> 缩小
env: yolo or whatever or dev
=> 没有缩小
您可以有一个开发命令,使用将覆盖默认设置的开发配置文件 _config.yml
。 See command options
在新的_config_dev.yml中,设置:
env: dev
提供缩小版:jekyll serve
。
未缩小的服务:jekyll serve --config _config.yml,_config_dev.yml