Using gem locally, using remote on github

I use minimal-mistakes. For more convenience when updating the theme I switched from a cloned and modified repo to a gem based theme on my computer, which builds really fast. However, after switching to gem I couldn’t get the page displayed on gh-pages anymore, so I added `remote_theme : “mmistakes/minimal-mistakes” to my _config.yml. Not it works on gh, but locally mm is also build as a remote theme, which is much slower 25 vs 2 seconds, and I need an internet connection.

How I can use gems locally, and have a remote theme on gh-pages?
`

you could use 2 config files - one for local and then the real one for GH. You can specify which config to run via the command line.

jekyll serve --config _alternative_config.yml

having two config files just for that purpose seems awfully hacky - is there really no other way?

Given this is a limitation of the remote theme plugin and of GH Paged that you deal with, using two configs sounds reasonable

To avoid duplication, you can have two configs passed to jekyll. The standard config and also the local config. That way the local config can be really short with just the overrides you need. The second config name passed will override values of the first config.

--config _config.yml _config_local.yml
2 Likes

thanks, I got it working after a few tweaks. specifically:

i) the config files are specified as a comma separated list without space: _config.yml,_config_local.yml
ii) I needed to specify an (invalid) remote_theme option in _config_local.yml to override the first one, e.g.: remote_theme: none - jekyll then falls back onto the theme option I specified in the second one

final remark: I understand that it’s cleaner and reduces error sources to just use the remote theme for local preview, but it would be really nice to be able to store a local copy so you can work faster, and offline.

2 Likes

That’s good to hear.

Try null - that is the YAML way of a null value. Or an empty string - ''.
I don’t think none is valid - it become the string 'none'.

Add a feature request on remote theme plugin - there might be one already.

Also, it might be because you have a really big theme that it takes 25 seconds. The remote theme fetching only look like a second to load a theme for me before.

null doesn’t work, it then uses the remote theme again.

you mean in the sense that I suggested - to store an offline copy?

What if you added a call to the local theme via the Gemfile?

gem 'minimal-mistakes', path: '/home/mluerig/projects/minimal-mistakes/'

You wouldn’t want to commit this, but it should work to pickup local files during the build.

The Gemfile is not used by github pages so it is fine to add to it in version control.

And local path doesn’t matter. Local install will still install from RubyGems.

It can just be

gem 'minimal-mistakes'

The problem is that remote theme must only work on github pages and the local config needs the override to turn off remote theme - none seems to work above as a plugin thing as that is not a YAML thing