Public | Automated Build

Last pushed: 9 months ago
Short Description
Builds the lightweight mixin library for Sass
Full Description

lamehat.se build tools (using Docker)

Builds all the tools I need to build my site with Jekyll. Inspired by Travis Neilson (from DevTips) walkthrough here: How to make your CSS awesome with Bourbon, Neat, Bitters and Refills! - YouTube

This includes the following bits:

  • ruby-base – builds a ruby base image using alpine linux, which all other images depends on
  • jekyll – builds jekyll, but with a wrapper script that checks for Gemfile when run.
  • bourbon – builds the lightweight mixin library for sass
  • bourbon-neat – grid framework built with sass
  • bourbon-bitters – scaffold styles ,variables and structure for bourbon projects
  • guard-jekyll-plus – Adds guard which makes it possible to use LiveReload with Jekyll

If you feel I am missing something or need it to be even more generic than it is (to be used by everyone) then feel free to contribute!

How to build

$ cd ruby-base
$ docker build -t tjakobsson/ruby-base:1.0 .
$ cd ../jekyll
$ docker build -t tjakobsson/jekyll:1.0 .
$ ...

How to run

$ docker run -ti --rm -v $(pwd):$(pwd) -w $(pwd) tjakobsson/jekyll:1.0 new my-new-site
$ cd my-new-site
$ docker run -ti --rm -p 4000:4000 -v $(pwd):$(pwd) -w $(pwd) tjakobsson/jekyll:1.0 serve --host=0.0.0.0

I guess you don't want to write all the above for doing jekyll commands. So you should create a function and put it in your .bashrc:

# run jekyll through docker
function jekyll { docker run -ti --rm -p 4000:4000 -v $(pwd):$(pwd) -w $(pwd) tjakobsson/jekyll:1.0 "$@"; }
export -f jekyll

After restarting your bash you should now be able to run jekyll as if it was installed on your local OS

bash-4.4$ jekyll -v
jekyll 3.3.0

How to run Jekyll and LiveReload

Gemfile

Update your Gemfile in your jekyll project. Add these:

gem 'guard'
gem 'guard-jekyll-plus'
gem 'guard-livereload'

Add a Guardfile in the root of your jekyll project with this in it:

guard 'jekyll-plus', :serve => true do
  watch /.*/
  ignore /^_site/
end

guard 'livereload' do
  watch /.*/
end⏎

Update your _config.yml so it excludes the Guardfile, other wise, that will be copied in to your _site-folder.

I am a fish-user. In shortage of time, this is how I've setup my ~/.config/fish/conf.d/guard.fish

function guard
  command docker run -p 4000:4000 -p 35729:35729 --rm -ti -v (pwd):(pwd) -w (pwd) tjakobsson/guard-jekyll-plus:1.0
end

Port 4000 is for the web server and 35729 is used by LiveReload

Docker Pull Command
Owner
tjakobsson
Source Repository

Comments (0)