My development blog, generated and compiled using Jekyll and the webpack config from Laravel Mix.
Install node packages
yarn install
To build for production, run:
yarn run production
If you get a jekyll error with the above command, run:
jekyll build
To watch files and start a local server, run:
yarn run watch
The server address will then be output in your terminal.
If you need to test on other devices on the same network use Browser Sync. cd
to the root of the project and run:
browser-sync start --server 'public' --files 'public'
This will output an External IP.
Note, you should use browser sync at the same time as the above watch command.
The public
directory is rebuilt every time the project is built. You should therefore place no files in this directory.
Create a new .md
file in src/_posts
. This will then be compiled using the template src/_layouts/post.html
. The default route is /:categories/:title/
. This can be updated in the _config.yml
file.
Create a new 'PAGENAME.html' file in the root of the src
folder.
Ensure the post has the categories assigned. When creating a new category, create a file for its hub page in src/category/CATEGORYNAME.md
, this should contain the category name and reference the layout file like so (for the category 'test'):
---
category: test
layout: category
---
Images should be placed in src/assets/img
. These will then be moved into public/assets/img
when the project is built.
Place any SVGs to be included in the SVG sprite in src/_img/svgs
. Note, the yarn run watch
command will not watch this folder. You need to run either yarn run production
or yarn run dev
to compile the sprite.
Install command line tool
xcode-select --install
Check ruby is at least 2.3.3
ruby -v
2.3.3
Install Jekyll
gem install bundler jekyll
This cheatsheet is particularly helpful when working with Jekyll.