How to speed up the compilation of your Jekyll website when you use npm modules

Chances are high that you are going to use plugins from npm in your Jekyll website. For example you might want to minify the CSS files by using Gulp, or bundle together your JavaScript files with Webpack.

A new node_modules folder is going to be created on the root of your website and now all of a sudden your website need much more time to be build when you start the development-server with Jekyll serve.

The problem is that Jekyll parses and copies every file from the node_modules folder into the auto generated _site folder, which is the “online” folder of your website.

If you want to command Jekyll to exclude the node_modules folder from _site then add the following line in your _config.yml file:

exclude: [node_modules]

When you are a Windows user, by excluding the node_modules folder, you also avoid the common problem of npm with the long file paths of plugins.

comments powered by Disqus