I just noticed that jekyll has all it needs installed locally, but a remote-theme is fetched every time jekyll is started.
I've also seen that people proposed a cache extension which hasn't been merged yet.
So I wonder if it is possible to just clone the remote theme to a certain folder?
ok, found the solution:
most themes are available also as ruby gems. So instead of specifying a remote-theme, I add the corresponding gem to Gemfile
gem "minimal-mistakes-jekyll"
and then reference it in the _config.yml
theme: minimal-mistakes-jekyll
Related
Lately I've gotten into Jekyll for building documentation sites and hosting them on Github Pages. I understand Github Pages has a very limited list of what is allowed plugin wise. While doing some vulnerability testing I found out the file Gemfile.lock is vulnerable to XML External Entity (XXE) Injection.
In my research I've read:
Should Gemfile.lock be included in .gitignore?
A Gem's Gemfile.lock should NOT be in source control.
Setting up your GitHub Pages site locally with Jekyll
After reading the accepted answer of:
Assuming you're not writing a rubygem, Gemfile.lock should be in your repository. It's used as a snapshot of all your required gems and their dependencies. This way bundler doesn't have to recalculate all the gem dependencies each time you deploy, etc.
but I have no control over the Jekyll site. Please correct me if I'm understanding the process but Github Pages builds the site and if the Gemfile.lock is for development of Gems and that isn't something I can control it's ok to remove the file and add to the .gitignore?
GitHub Pages doesn't look for a Gemfile.lock file nor the Gemfile itself.
All it needs is a proper config file to load gems / plugins.
I'm trying to install Github Pages' Slate theme on my CentOS 7 VM so I can locally preview my new site using the bundle exec jekyll serve command.
I followed the instructions as best as I could.
I changed the theme minima to jekyll-theme-slate in my _config.yml file.
Then I changed gem "minima", "~> 2.0" to gem "github-pages", group: :jekyll_plugins in my Gemfile file.
After that (since these are their only instructions), I ran bundle exec jekyll serve and it told me I had gems that weren't installed (duh), and suggested running bundle install.
I ran bundle install, which told me there was a conflict in version types of the dependencies and it suggested that bundle update could potentially resolve that issue.
No problem, I ran bundle update. A few plugins/features actually reverted versions here, but I got the Slate theme installed on my machine now, version 0.0.4 for whatever reason.
After that, I ran bundle exec jekyll serve again. I got this error:
Configuration file: /home/peri/my-site/_config.yml
Configuration file: /home/peri/my-site/_config.yml
jekyll 3.4.3 | Error: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
In a way, that error makes sense. For a custom theme to work, I probably need a tool to run their custom scripts. But first, I noticed this extra section in the theme's installation instructions, which directly mentions being able to locally preview the site with that theme.
I downloaded the source, instead of cloning it...I don't need the .git stuff do I?
I edited the script/bootstrap file because /usr/local requires root and using sudo doesn't know about any binary called gem or bundle. I changed gem and bundle to their respective absolute paths and ran sudo ./script/bootstrap inside of slate-master.
Point of the story is, it didn't work for my home/peri/my-site directory when I ran bundle exec jekyll serve. Presumably, it's because they intended for the user's site to be integrated into their theme's source code? That doesn't seem intuitive or correct. So, I investigated ExecJS.
I installed it. gem install execjs
I added gem "execjs", "2.7.0" to my Gemfile file.
Got the same error as before.
How am I supposed to install this Jekyll theme?
Follow these steps after changing the theme in _config.yml:
Gemfile should have only this content:
source "https://rubygems.org"
gem "github-pages"
remove bundler current config: rm -r .bundle/
remove Gemfile.lock: rm Gemfile.lock
Install local dependencies in an isolated folder just for this website: bundle install --path=vendor/bundle
You won't have post and page and home themes, you will need to use just default in all your posts.
Generate and run server: bundle exec jekyll s
I think I'm just at the finish line for installing jekyll on windows, It's connecting fine, but I'm getting an error message:
Liquid exception: No such file or directory - python C:/Ruby193/lib/ruby/ms/1.9.1/gems/pygments.rb-0.6.3/lib/pygments/mentos.py in _posts/2015-06-09-welcome-to-jekyll.markdown<-[0m done.
Please add the following to your Gemfile to avoid polling for changes: gem 'wdm','>=0.1.0' if Gem.win_platform
I'm not sure what messages I can ignore and what I need to fix. What do you guys think?
If adding this to my gemfile is as simple as entering a cmd prompt, what do I need to enter to install it?
This was an issue that was addressed by me by another question a few days ago.This is the original question and my answer.
Basically the issue here is that you need to install Python to use Jekyll on Windows because the code highlighter Pygments is written in Python, hence requires Python to function. Pygments is alsothe default code highlighter currently. In the future versions of Jekyll will use the Rouge highlighter, which is written completely in Ruby. This issue is tracked on GitHub.
To solve your current problem, you just need to install Python 2.x, which the official linked guide from the Jekyll documentation provides very clear instructions there. You will also need to install pip. I have also included alternatives in the other SO answer I have given, so I will just provide you the link to it to reduce duplicate information and copy-paste.
Once you have Python 2.x and pip set up, and install pygments, your Jekyll install should be up and running with the site template!
Regarding the Gemfile
A summary of what a Gemfile is: A file that lists all the required Ruby gems for a particular program. For example, you wrote a ruby program that depends on 10 other gems, rather than ask the user of your new gem to go download the previous 10 gems, and then later wrestle with outdated gem issues, a Gemfile is used to keep track of what gems are needed and version. The Gemfile is used by Bundler, which is also a gem that automatically keeps track of what gems you need. In the case of Jekyll, you can use a Gemfile to dictate what you want added into your Jekyll install or removed. This is used by GitHub to keep local versions of Jekyll and other gems updated with the version used by Github Pages.
As for that notification, all you would need to do to avoid polling for changes is:
Open notepad or text editor of choice.
Add this line: gem 'wdm','>=0.1.0' if Gem.win_platform, just that line of text. You can later add gems by typing in gem 'nameOfGem in a separate line.
Save the file as Gemfile in your Jekyll site's folder. Notice that there is not .txt extension, which you can create a file with no extension in notepad by choosing 'All Files' instead of '.txt' under 'Save As'. Or, you could just edit the file extension to remove the .txt.
Install bundler by executing gem install bundler.
Run bundle install to update the gems. If you're using GitHub, add the Gemfile and the newly generated Gemfile.lock into git.
After upgrading my web application based on Jekyll 1.4.3 to Jekyll 2.0.2, my home page does not incorporate the specified layout file.
Here are the steps to reproduce:
Download https://github.com/morea-framework/basic-template/tree/jekyll-2.0.
This is the jekyll-2.0 branch of my web application, which is a stripped down version to illustrate the problem. If you clone the repo, be sure to switch to the jekyll-2.0 branch.
gem uninstall jekyll
gem install jekyll -v '1.4.3'
This installs the version of jekyll in which the site builds correctly. For reasons not apparent to me, I ran into problems when I had both 1.4.3 and 2.0.2 installed simultaneously.
cd basic-template/master/src
jekyll serve --baseurl ''
This brings up my web application. If you now go to http://localhost:4000, you should see:
Now control-c to stop the application, and invoke:
gem uninstall jekyll
gem install jekyll
jekyll serve --baseurl ''
These three commands uninstalls Jekyll 1.4.3, installs Jekyll 2.0.2, and reruns Jekyll. Now if you refresh http://localhost:4000, you should see:
As you can see, the CSS styling is no longer present. That's because the layout specified in the Front Matter has for some reason not been included.
Can anyone tell me why my code no longer works correctly under Jekyll 2.0.2?
Your post references the post.html layout in it's front matter, which in turn references the default layout. The default layout doesn't exist in your _layouts folder:
https://github.com/morea-framework/basic-template/blob/jekyll-2.0/src/_layouts/post.html
You should always have a default layout.
Working with Jekyll for the first time, and it looks like the auto reload functionality (running jekyll --auto --server) is only triggered by updates to markdown files.
Is this the normal behavior? And is there any way to get changes to other types of files like css (I'm using scss) or html files in _layouts to trigger an auto-reload as well?
As of version 3.7 run jekyll serve --livereload.
As mentioned here, you need to downgrade the directory_watcher gem, which was recently updated with a breaking change.
sudo gem uninstall directory_watcher && sudo gem install directory_watcher -v 1.4.1
(Or alternatively use the latest master branch of jekyll, which is fixed to depend on the older version of directory watcher).
I have not found this to be the case, but perhaps you can update your version
git clone --depth 1 git://github.com/mojombo/jekyll.git
cd jekyll
gem build jekyll.gemspec
gem install jekyll
The problem with jekyll watch option is that only rebuild the _site directory,
I recommend you gulp sass
With it you can not only build the _site folder, but have a full browser reload automatically, whenever you hit ctrl+s in any file, the browser will reload.
If you're running it frequently, the Repla macOS app makes it easy to startup Jekyll so it automatically refreshes. After Repla is installed, you run it from the Jekyll blog's root directory and pass it the jekyll serve command. For example:
repla server "bundle exec jekyll serve --watch --drafts" -r "...done"
Repla will be configured to refresh each time ...done is printed in the console, which Jekyll prints when it finishes compiling your site.
Repla runs the Jekyll server process in a split below a browser split showing your site:
After Jekyll is running in Repla, you can also save the configuration to a file with ⌘S, shut it down by closing the window, and run it again just by double-clicking the file. In other words, you can start your Jekyll blog again next time just by opening the file, without involving the terminal at all.
Disclosure: I maintain the Repla app.