Using development configuration for local development in Jekyll
I’ve been using Jekyll to power this blog for quite some time now. I quite like the simplicity of Jekyll. But there’s this one thing that I don’t like about it.
The problem
So, to give you a little bit of context, the blog currently hosts about 480+ posts. And I’ve been adding new posts to the blog every now and then. And this is where the problem lies.
When I’m working on a new post, I have to run the jekyll serve
command to see the changes. And this command takes a lot of time to run. And this is because Jekyll has to build the entire site every time I run the command. The build time is around 30 seconds. And this is a lot of time to wait for every time I make a change to a post.
I’m also using a bunch of plugins such as jekyll-feed and jekyll-sitemap. These plugins try to generate an RSS feed and sitemap every time I do some changes to the site. These plugins are the main reason why the build time is so high.
Here’s how this looks like in _config.yml
:
plugins:
- jekyll-sitemap
- jekyll-feed
- jekyll-seo-tag
- jekyll-paginate
I needed some way to somehow remove these plugins when I’m doing local development. And I found a way to get around this problem.
Development configuration
Jekyll allows you to have multiple configuration files. And you can specify which configuration file to use when you run the jekyll serve
command.
I created a new configuration file called dev.yml
and removed both the jekyll-sitemap
and jekyll-feed
plugins from it. Here’s how it looks like.
plugins:
- jekyll-seo-tag
- jekyll-paginate
Now, when I run the jekyll serve
command, I can specify the dev.yml
configuration file using the --config
option like so.
$ bundle exec jekyll serve --config dev.yml
This way, I can run the jekyll serve
command without having to wait for 30 seconds every time I make a change to a post. And this is a huge time saver for me.
Like this article?
Buy me a coffee👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.