5

I'm new to Middleman and ruby in general.

I've installed Ruby I've installed Middleman and the gems to get it running.

I need to use slim instead of the default template system.

So I installed the Slim gem. Slim's website only says that I need to require 'slim' in order to get it to work.

The middleman website says I only need add the template engine to the config.rb file, but it gives no examples...

For someone with no ruby background, this is no help.

I looked for several config.rb on git and they all have:

require 'slim'

And

# Set slim-lang output style
Slim::Engine.set_default_options :pretty => true

# Set template languages
set :slim, :layout_engine => :slim

I added that to my config.rb file and created the layout.slim and the index.html.slim

When I refresh my local server I get:

Not Found

`/' not found.

I have middleman installed with Boilerplace. I'm not sure if there are more files that I need to change, but I can't find any good resources online, which is odd.

Could anyone give me some direction as to what I'm missing?

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123

3 Answers3

13

So here we go... after much reading and searching google for examples I think I figured it out.

To get Slim working with Middleman

  1. Add gem "slim" to your project's gemfile
  2. go to command line, in your project folder and gem install bundler
  3. In the config.rb file add require 'slim'
  4. Start the middleman server to test it
  • Make sure you specify the `markdown_engine` as a string and not a symbol: `set :markdown_engine, 'slim'` – steakchaser Aug 14 '15 at 06:26
  • Since answers are quite old, I just wanted to note that this a variation of this is what still seems to be the way: add `gem "slim"` to Gemfile, run `bundle` to install it, `require "slim"` in config.rb. I'm not sure what @steakchaser's comment is about – it seems unrelated, and I have not had to touch Markdown engine settings. – Henrik N Mar 27 '22 at 17:10
1

The middleman-slim project by yterajima is helpful in this regard.

Install is very easy.

$ gem install middleman
$ gem install middleman-slim
$ middleman init PROJECT_NAME --template slim
Jonathan
  • 10,936
  • 8
  • 64
  • 79
0

Bundler tip: you can also include multiple gems at once using Bundler.require. If you have gems in groups, you can include them as such: Bundler.require :group1, :group2 ...

Steve Benner
  • 1,679
  • 22
  • 26