Middleman is powerful, but to get the most out of it you must learn how to configure it. First of all, you should get to know which settings are available to you. Visit http://localhost:4567/__middleman/config to see all settings in your current environment. For each setting it shows a description, current value and default value.
In this post I will share how my config looks like. We already activated LiveReload in the last post, so let us open
Being used to the directory structure in Ruby on Rails I wanted to mimic this for my Middleman assets.
I then created a directory called
source and moved the files there.
Add the following to your
Gemfile and then run
Enable Redcarpet and fenced code blocks in your
set :markdown_engine, :redcarpet set :markdown, fenced_code_blocks: true
Do not forget to activate syntax highlighting:
The SCSS I am using for syntax highlighting can be found on GitHub.
In Middleman you have the option to use different settings for different environments. These are the build settings I am using:
So, what is going on here?
asset_hashmy asset filenames will change every time the file content has changed. By doing this, it is possible to cache them for a very long time.
- My images are optimized using the middleman-imageoptim extension.
- I am using my own CDN and hosting my assets on CloudFront. I will cover how to set this up in a future post.
If you want to see my entire
config.rb you can find it on GitHub.