Questions tagged [middleman]

Use the popular Ruby Sinatra (Rails-like) Tool chain to build static websites. Build your source files in Markdown, HAML, Textile (or many others), and take advantage of SASS with Compass for styling. Add Javascript, CoffeeScript and Sockets. View the sites locally with the built-in server mode before building static pages. Includes international (i18n) support. Mix in YAML data files and custom Ruby extensions if needed. Unlimited Buzzwords Galore!

Middleman is a static site generator based on Sinatra (a Rails-like Ruby based tool chain). It incorporates dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). It makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle.


Typical Development Cycle

This is the typical development cycle with Middleman:

  • Run middleman init projectname
  • Start the server with middleman server
  • Modify the files in the directory projectname while viewing them in your browser at http://localhost:4567
  • When you're happy with the files, run middleman build
  • Copy the generated static files from projectname/build to your webserver

Having the server available while developing turns out to be critical, as it allows quick review of changes ( For auto-reload, use middleman-livereload gem). This isn't as much of an issue with "normal" static site generators, but when you start adding partials, SCSS, Compass and the other goodies, that Middleman supports, server mode is invaluable.

Resources

553 questions
5
votes
0 answers

Multiple source directories in middleman

I have a few projects with common files, so I have made source/shared directory for them. File structure looks like: . ├── config.rb ├── build ├── source │   ├── project-1 │   │   ├── index.html.slim │   │   ├── js │   │   │   ├──…
5
votes
2 answers

Slim is giving undefined error with middleman

Have tried searching for some blogs on resolving this issue, unable to do so. Getting the following error when I try starting middleman server. /var/lib/gems/1.9.1/gems/middleman-core-3.3.10/lib/middleman-core/renderers/slim.rb:31:in `registered':…
Vivek Chandra
  • 4,240
  • 9
  • 33
  • 38
5
votes
1 answer

Using Sprockets in Coffeescript, how do you //require?

Currently, I have my all.js file with this: //= require jquery //= require jquery.nicescroll.min //= require bootstrap.min $(document).ready(function() { $('.carousel').carousel(); $('html').niceScroll(); }); I would like to move it into…
Daryll Santos
  • 2,031
  • 3
  • 22
  • 40
5
votes
2 answers

Why does `middleman serve` work, but `middleman build` fails to compile this Sass?

When I just run middleman to serve, all.css gets compiled fine, consisting of just a call to +box-shadow(none): /* line 1, /home/yang/asdf/source/stylesheets/content.css.sass */ div { -webkit-box-shadow: none; -moz-box-shadow: none; …
Yang
  • 16,037
  • 15
  • 100
  • 142
5
votes
3 answers

How to install and use Slim template engine with Middleman

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…
user1214678
4
votes
2 answers

How can I do i18n for javascript with Middleman?

Is there something already in the technology stack used by MM that will handle i18n for JS? E.g. something that will take a javascript: section out of an en.yml and es.yml file and make it available as a translation.js file - or something similar (I…
mm2001
  • 6,427
  • 5
  • 39
  • 37
4
votes
2 answers

Unable to resolve dependency: user requested 'did_you_mean (= 1.2.0)' (Gem::UnsatisfiableDependencyError)

I just got a job and my first task is to create a documentation of our current code. I would really appreciate it if someone could help me. I'm got this error setting up the code for the documentation. I was able to run bundle install without…
tricenee
  • 51
  • 1
  • 3
4
votes
0 answers

Loading command: install (LoadError) cannot load such file -- socket

I bought new Macbook pro and moved all data from iMac to new Mackbook pro. then I tried to check the version of bundle with "bundle -v", I got -bash: bundle: command not found them I tried "gem install bundler", I got ERROR: Loading command:…
riiinoj
  • 41
  • 2
4
votes
1 answer

Middleman INIT Error

I recently just took over a middleman-netlify website. git clone {website codebase url} bundle install bundle update middleman init (error issue) I don't know what to do next. I have tried the following uninstall middleman and gems, reinstalled,…
Stephanie
  • 105
  • 1
  • 10
4
votes
2 answers

Using global variables in middleman? i.e. Website title

I'm trying to find a way to use global variables within middleman, i.e. set website name and use it as a fallback if current page doesn't have a title or when passing app title parameter inside metas like
Ilja
  • 44,142
  • 92
  • 275
  • 498
4
votes
0 answers

In Middleman, redirects to a temporary home page in my config.rb not working

Originally in my config.rb I had the following: activate :i18n, mount_at_root: false, langs: ['en-us', 'es-mx'] activate :directory_indexes redirect 'index.html', to: 'en-us' This works great for redirecting localhost:4567/ to…
robertwbradford
  • 6,181
  • 9
  • 36
  • 61
4
votes
1 answer

Bootstrap JS not working with Middleman

Attempting to get a very simple bootstrap site up and running the JS/jQuery for the dropdowns appears to not be working. gemfile #default stuff... gem "sass" gem "bootstrap-sass","~> 3.3.5", :require => false layout <%=…
James L.
  • 12,893
  • 4
  • 49
  • 60
4
votes
1 answer

Cannot pass authentication sending ajax request to mailgun

I can do this: curl --user 'api:MYAPIKEY' -F from=foo@bar.it -F to=MYEMAIL@gmail.com -F subject='foo' -F text='bar' https://api.mailgun.net/v3/sandbox93d8299f673a4c3295b7592956cb3d9.mailgun.org/messages but I get a login popup when I try to do the…
masciugo
  • 1,113
  • 11
  • 19
4
votes
2 answers

Middleman images/fonts from bower

I'm wondering what the best way is to use images & fonts from bower packages with middleman. As an example, I'm trying to add the slick.js carousel to my project. It's on bower and includes css, js, images, and fonts in the bower code. With…
danny
  • 10,103
  • 10
  • 50
  • 57
4
votes
1 answer

Unable to use HAML layouts with Middleman

I've been having trouble switching from a default layout.erb file to an equivalent layout.haml file in Middleman. I want to use HAML for my layouts since I'm trying to become familiar with it, so I decided to replace the default layout with a HAML…
r.pazyaquian
  • 73
  • 1
  • 6
1 2
3
36 37