Closed laukstein closed 6 years ago
@laukstein I believe if you set theme: none
or theme: ""
it should not use the Primer theme (which is the source of the asset).
@benbalter, Jekyll fails when used theme: none
or theme: ""
in _config.yml, see
with theme: none
Configuration file: .../_config.yml jekyll 3.5.2 | Error: The none theme could not be found.
with theme: ""
Configuration file: ../_config.yml jekyll 3.5.2 | Error: The theme could not be found.
You should be able to remove the theme
key altogether and the site should still generate. I use this gem without a theme
key and don't have this file.
@mattr-, it gets me generated without theme
key. See the above comment, the issue might be related to group: :jekyll_plugins
.
I don't put the github-pages
gem in the jekyll-plugins
group either, so maybe that's the ultimate fix? No idea.
@mattr-, github/pages-gem recommendation is to use group: :jekyll_plugins
, so #482 is a issue.
@mattr- https://github.com/pages-themes/primer is the default theme, set by the GitHub Pages Gem when no other theme is specified, so that workflows can be as simple as committing markdown files and having a site. It is largely independent, unless of course, you care about extraneous assets i the built site.
@laukstein What if you add the following to your config (and remove the theme suggestion above):
exclude:
- assets/javascript/anchor-js
I believe that should exclude the extraneous assets from appearing in your built site.
@benbalter,
exclude: - assets/javascript/anchor-js
it will still generate _site/assets/javascript/anchor-js
It actually generates all https://github.com/pages-themes/primer/tree/master/assets assets, also .../css/style.css file.
@parkr ☝️ is it possible themes don't respect the excludes
directive?
@benbalter According to my first tests, it seems so.
https://github.com/pages-themes/primer is the default theme, set by the GitHub Pages Gem when no other theme is specified, so that workflows can be as simple as committing markdown files and having a site.
@benbalter 😕 I'm not putting github-pages
in the jekyll-plugins
group of the Gemfile in my site. Is this what keeps these files from being generated since the hook doesn't get run? I don't have a theme
key in my config. I'd like to make sure I've got it run so I don't give folks wrong info in the future. 🙂
Is this what keeps these files from being generated since the hook doesn't get run?
Correct. When in the jekyll_plugins
group it's required earlier in the boot process, so https://github.com/github/pages-gem/blob/master/lib/github-pages.rb#L18-L20 can fire and set the theme
config directive, before Jekyll configures the theme in site
. The jekyll_plugins
group allows the plugin to set configuration defaults and overrides prior to the site object being setup, and before other plugins.
TIL. Thanks! :heart:
is it possible themes don't respect the excludes directive
Definitely possible! Feel free to close this and opens bug report to solve that in Jekyll.
We have no way of knowing whether someone has used this resource so the best thing is probably to re-evaluate having the resource in the theme, consolidating the resource into another resource so it's less obvious it's not useful (heh), or ensuring it is excludable.
If closing this task, please referrer here the actual (new) issue.
A simple ugly fix is to delete the line 19 of the lib/github-pages/configuration.rb
:
"theme" => "jekyll-theme-primer",
Here is the new generated tree:
.
├── Gemfile
├── Gemfile.lock
├── index.html
└── _site
└── index.html
Instead of:
.
├── Gemfile
├── Gemfile.lock
├── index.html
└── _site
├── assets
│ ├── css
│ │ └── style.css
│ └── javascript
│ └── anchor-js
│ ├── anchor.js
│ ├── anchor.min.js
│ ├── banner.js
│ └── docs
│ ├── anchor.js
│ ├── favicon.ico
│ ├── fonts
│ │ ├── anchorjs-extras.eot
│ │ ├── anchorjs-extras.svg
│ │ ├── anchorjs-extras.ttf
│ │ ├── anchorjs-extras.woff
│ │ └── fonts.css
│ ├── grunticon
│ │ ├── grunticon.loader.js
│ │ ├── icons.data.png.css
│ │ ├── icons.data.svg.css
│ │ ├── icons.fallback.css
│ │ └── png
│ │ └── grunticon-link.png
│ ├── img
│ │ ├── anchoring-links.png
│ │ ├── anchorjs_logo.png
│ │ ├── anchorlinks2.png
│ │ ├── gh_link.svg
│ │ ├── gh-link.svg
│ │ ├── hyperlink.svg
│ │ ├── link.svg
│ │ ├── mini-logo.png
│ │ └── primer-md.png
│ ├── scripts.js
│ └── styles.css
└── index.html
I am not a "ruby man" but I think it could be possible to do something like:
IF theme is unset
THEN
theme = jekyll-theme-primer
ELSE IF theme == false OR theme == "none"
THEN
UNSET theme
FI
You can check my docker-github-pages test patch.
In _config.yml
this works fine to me:
theme: false
@oscarotero, I just checked it and in local machine and it gets rid anchor-js
, so far fine. Unfortunately it would return also error/warning:
Theme: value of 'theme' in config should be String to use gem-based themes, but got FalseClass
I didn't try, but it might be that GitHub Pages build would fail/break on it.
@laukstein I have that error too, but github build doesn't break. This is the project: https://github.com/oscarotero/oscarotero.github.io
If the error irks you, the workaround I'm using for now is setting my theme to be a remote one that I just found with basically nothing in it. So in _config.yml
:
remote_theme: garrettboatman/Blank-Theme-Jekyll
This was fixed via https://github.com/pages-themes/primer/commit/0dd5532c02a3862a9906080016bfe090e221b6f1. Anchor-JS is no longer bundled with the Primer theme.
@benbalter this issue still must stay open till Github Pages adopts this fix. Doesn't Github Pages depends on landed packages? And if so then this fix still may take time.
Issue discussed in https://github.com/jekyll/jekyll/issues/6358
When used pages-gem recommended Gemfile
even when this Gemfile and minimal _config.yml are the only files in Jekyll dir, on
jekyll serve
it will generate _site/assets with anchorjs. Why?The only way I found to remove _site/assets was to remove Gemfile or have it
gem "github-pages"
without ~group: :jekyll_plugins
~.