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
7
votes
1 answer

Why do I get this error when I run 'bower install'?

I am using this middleman project and trying to run the bower install and get the following... bower not-cached git://github.com/jquery/jquery.git#~2.0 bower resolve git://github.com/jquery/jquery.git#~2.0 bower not-cached …
Antonio Pavicevac-Ortiz
  • 7,239
  • 17
  • 68
  • 141
7
votes
2 answers

middleman - asset path for CDN at build time

I want to do the following if build? assetPath = "//cdn.domain.com/assets" else assetPath = "assets" end trying all combinations and reading everywhere but simply stumped at the moment ruby and middleman - still learning.
Ian Warner
  • 1,058
  • 13
  • 32
6
votes
1 answer

Pass a variable to template in Middleman 2

I have a Middleman project and I need to emulate a logged-in user. Simple enough - would be fine to set some global variable like @user = 1 in config.rb, code everything for the logged-in user, then set the variable to 0 and code everything for the…
Guard
  • 6,816
  • 4
  • 38
  • 58
6
votes
1 answer

Meta Descritpion in HAML with outside variable

I'm trying to get my meta description to work in HAML and everything I try produces errors. %meta{:name => "description", :content => "Some content"}/ %title = data.page.title The code above works. Now I try the following: %meta{:name =>…
Noah Clark
  • 8,101
  • 14
  • 74
  • 116
6
votes
1 answer

rails delete_if using hashes to ignore current article (Middleman)

I've got an easy one for you guys. I want to have a featured content section where the current article is EXCLUDED So this works using Middleman Blog with delete_if: <% blog(content).articles.delete_if{|item| item == current_article}.each do…
umbriel
  • 723
  • 1
  • 7
  • 22
6
votes
3 answers

How do I import a .scss.erb file in middleman4?

How do I import a .scss.erb file in Middleman 4? I just upgraded from Middleman 3 to 4. I think this is my last issue... I have an all.css.scss file that looks like this: @charset "utf-8"; @import "settings"; @import "imports"; @import…
David Silva Smith
  • 11,498
  • 11
  • 67
  • 91
6
votes
1 answer

How to include javascript in middleman 4?

I've been using Middleman for a while and it always used the Rails asset pipeline for including javascript and css. So to include a javascript module called "thing.js" in the same directory, you'd do: //= require thing But since Middleman 4, that…
straffaren
  • 337
  • 4
  • 10
6
votes
2 answers

Middleman - Unknown Extension: livereload

Trying to just get started building a site with Middleman, and I'm following the tutorial to a t, but when I start the server I always get "Unknown Extension: livereload" I already have group :development do gem 'middleman-livereload' end and…
Colby CheeZe
  • 93
  • 1
  • 7
6
votes
1 answer

Middleman paths not working on subdirectory

So, this is my first middleman project and I'm struggling with how middleman manages links. As it is, I've set it up on a github page. All my assets are working, so I got that right, but the paths leading to each pages fail on account of the…
benBecker
  • 63
  • 1
  • 7
6
votes
5 answers

Moving blog articles location in Middleman

I'm using the Middleman Blog gem for my site, but by default it appears the blog articles need to be located in /source which isn't particularly nice when looking at the tree in vim and trying to locate one of the other files in there (a template…
Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
6
votes
0 answers

Static site generator that generates JSON rather than HTML

I'm a big fan of static site generators like Middleman and Jekyll. Generating a complete blog from flat files and throwing them on Amazon S3 without having to worry about database-related performance and/or security issues feels pretty great. After…
superlukas
  • 481
  • 5
  • 12
5
votes
3 answers

Is there anything in PHP like middleman in Ruby?

I've been on a project with a buddy who is leading us with Middleman. We are coding in HAML and SASS and he's obviously a Ruby Dev. I'd like to know if there's ANY type of equivalent for PHP? I'm going to eventually lead a team and I'm much more…
jasonsemko
  • 743
  • 1
  • 7
  • 17
5
votes
0 answers

Getting jQuery and Bootstrap 4 JS working with Webpack and Middleman

Trying to get jQuery loaded up on my Webpack Config using Middleman. I'm trying to use: Middleman 4.2.1 Bootstrap 4 Beta jQuery 3 I have Bootstrap's CSS loading but now having problems trying to load jQuery along with Bootstrap's JS…
Wasabi Developer
  • 3,523
  • 6
  • 36
  • 60
5
votes
2 answers

Using Nokogiri to generate static header list in Slate/Middleman

I'm inexperienced with middleman and ruby, but I've been trying to get Slate working so it generates a side navigation/list of header during build time instead of client side using javascript. The problem I am running into is getting the code to…
Alyss
  • 1,866
  • 1
  • 13
  • 27
5
votes
4 answers

Edit YAML Frontmatter in markdown file

Is there some way in ruby to edit the YAML Frontmatter at the top of a markdown file, like those used in Jekyll and Middleman? Something like: def update_yaml #magic that changes A: 1 to A: 2 in Frontmatter block end Then my markdown file which…
lyonsinbeta
  • 919
  • 6
  • 25
1
2
3
36 37