The main aim of this project was to find a best way to capture my work and present it to the internet. I have created a custom theme for Jekyll. Later on I introduced Gulp.js, because certain funcationality, important to me, is still missing in Jekyll for ex. live browser refresh, vendor autoprefix, javascript minification, image optimisation, better handling of sass and more advanced watch tasks.
The instructions below cover Windows 10 and MacOS 10.15, and later versions.
- Install RubyInstaller
- Run
gem jekyll install bundler
- Install Node.js
- Run
npm i
- Run
npm i -g gulp-cli
If you have already installed GCC, Git, Node.js and Gulp.js I would recommend checking for updates and installing all available updates.
- GCC: Download all available updates for Xcode in App Store
- Git: The easiest way to update Git is to download the latest version from the official website
- Node.js and Gulp.js can be updated by running
npm update -g
If any of these tools are missing I would strongly recommend to do a clean install.
It is recommended to follow the order of instructions to prevent possible errors.
- Install Homebrew. Select to install command line tools.
- Install Git
brew install git
- Install rbenv
brew install rbenv
- Make rbenv run everytime terminal is open
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
- Restart terminal for the previous shell command to work.
- Install Ruby with rbenv
rbenv install 3.1.2
- Switch from system Ruby to rbenv
rbenv global 3.1.2
- Install Jekyll:
gem install jekyll
- Update all system gems:
gem update --system
- Install Node Version Manager.
- Install Node:
nvm install node
- Install all dependencies
npm i
- Link Gulp
npm link gulp
Here is what happens when you type gulp
in terminal:
-
Gulp takes files from
_assets
directory (don't rename this directory) applies all the specified Gulp tasks, createsassets
directory and copies optimized assets into this directory. -
When all assets are built Gulp triggers
jekyll build
and Jekyll grabs everything fromassets
directory and copies to_site/assets
directory. -
When Jekyll is built, Gulp executes a watch task and tracks changes (yes, even
_config.yml
) and applies them straight away with live browser reloading.
To push all changes to master
and _site
contents to gh-pages
branches, package.json
has a handy script called deploy
. You can call it by npm run deploy
.
For more information look into the contents of gulpfile.js
and package.json
.
- If anyone is using Visual Studio Code I would recommend installing a SASS syntax indentation and highlighting extension.
- If you decide to create your own project based on my, and host it on Github Pages, you might face issues with relative links. To solve this you need to do two changes one in
_config.yml
and second ingulpfile.js
. In_config.yml
you need to change:
baseurl: /YOUR_GITHUB_REPOSITORY_NAME
url: YOUR_GITHUB_USERNAME.github.io
In gulpfile.js
you'll need to create tasks Jekyll separate for local development and Github Pages like so:
gulp.task('build:jekyll:dev', function(callback) {
var shellCommand = 'jekyll build --incremental --baseurl "" ';
return gulp.src('')
.pipe(run(shellCommand))
.on('error', gutil.log);
callback();
});
gulp.task('build:jekyll:prod', function(callback) {
var shellCommand = 'jekyll build --incremental';
return gulp.src('')
.pipe(run(shellCommand))
.on('error', gutil.log);
callback();
});
Calling build:jekyll:dev
will rewrite the _config.yml
baseurl and keep relative links intact.
Aleksandr Ljamin
Bits and pieces of code are used from the following awesome projects:
- Poole Hyde built by Mark Otto. Open sourced under the MIT license.
- Forty Jekyll theme built by Andrew Banchich based on Forty HTML5 theme by HTML5UP. Under Creative Commons Attribution 3.0 Unported.
- Inspiration on CSS transitions from Riley Carroll.
- Jekyll and Gulp integration is based on the post by Anne Tomasevich.