无法通过Jekyll资产或Jekyll缩小器缩小Jekyll javascript

无法通过Jekyll资产或Jekyll缩小器缩小Jekyll javascript,jekyll,Jekyll,我花了很长时间研究如何让Jekyll(v4.0.0)缩小javascript。我已经安装了JekyllAssets(v3.0.12)和JekyllMinifier(v0.1.10)来实现这一点,但到目前为止运气不好。。。javascript仍然没有统一 我在_config.yml中尝试了许多没有帮助的配置选项,参考了这里的文档: 任何帮助都将不胜感激 Gemfile # frozen_string_literal: true source "https://rubygems.org" g

我花了很长时间研究如何让Jekyll(v4.0.0)缩小javascript。我已经安装了JekyllAssets(v3.0.12)和JekyllMinifier(v0.1.10)来实现这一点,但到目前为止运气不好。。。javascript仍然没有统一

我在_config.yml中尝试了许多没有帮助的配置选项,参考了这里的文档:

任何帮助都将不胜感激


Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

gem "jekyll", "~> 4.0"

group :jekyll_plugins do
  gem "jekyll-assets"
  gem "jekyll-minifier"
end
JEKYLL_ENV=production bundle exec jekyll build
\u config.yml

permalink: pretty

sass:
  style: compressed

exclude:
  - gulpfile.js
  - node_modules
  - CNAME
  - README
  - '*.json'
  - .DS_Store

plugins:
  - jekyll-assets
  - jekyll-minifier

assets:
  sources:
    - "css"
    - "js"
...
{% javascript app %}
...
\u包括/scripts.html

permalink: pretty

sass:
  style: compressed

exclude:
  - gulpfile.js
  - node_modules
  - CNAME
  - README
  - '*.json'
  - .DS_Store

plugins:
  - jekyll-assets
  - jekyll-minifier

assets:
  sources:
    - "css"
    - "js"
...
{% javascript app %}
...
js/app.js

//=require scripts.js
//=require scripts-2.js

var myStr = "app";
myStr += " js";
console.log(myStr);
命令行

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

gem "jekyll", "~> 4.0"

group :jekyll_plugins do
  gem "jekyll-assets"
  gem "jekyll-minifier"
end
JEKYLL_ENV=production bundle exec jekyll build

Jekyll创建静态站点后,Jekyll Minifier插件可能正在缩小_站点目录中的javascript。如果您使用的是github页面,这将不起作用,因为github是从源代码构建的,并且插件支持有限。您可能需要使用插件进行构建,并使用_站点目录手动提供服务,或者找到一个不同的插件,该插件可以就地最小化,而不是在_站点目录中