Questions tagged [middleman-4]

Version 4.0 of middleman.

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

33 questions
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
3
votes
2 answers

Switch to the another language on the same page?

I am trying to add a language changer for Middleman and it's not generating the correct link. My default and root is English. url_for("/#{current_page.path}", locale: :ja) I would expect the equivalent for the current page in JA which is the same…
Strawberry
  • 66,024
  • 56
  • 149
  • 197
2
votes
0 answers

How can I make middleman work with custom fonts & font-awesome through webpack?

I'm using middleman with webpack. Thus my config.rb contains this configuration for an external pipeline (webpack): activate :external_pipeline, name: :webpack, command: build? ? 'yarn run build' : 'yarn run start', …
alexanderadam
  • 415
  • 6
  • 17
2
votes
1 answer

Merging configuration files in different directories in Webpack

I am building a series of widgets via the middleman static generator and I am running into an issue with the Webpack configuration. Here are the goals. each widget needs to have its own JS and CSS file the widgets should share global configuration…
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
1
vote
1 answer

Middleman shows syntax error when using a link_to block

I'm using Middleman 4.2 with Middleman-blog 4.0.2. When I have: <% blog.tags.each do |tag, articles| %> <%= link_to "#{tag.titleize} - #{articles.size}", tag_path(tag) %> <% end %> I get the desired element output:
Matt Budz
  • 193
  • 1
  • 11
1
vote
1 answer

Middleman Hierachical yaml data by key name

I am creating a New Middleman website for the first time. I have roughly 20,000 pages I would like to make static and I am nearly there except for this 1 glooming problem. I have a CSV file that is produced monthly that I will convert to yaml. …
Pilot
  • 11
  • 2
1
vote
1 answer

Middleman build ignore swp files

How do I exclude swp files from the build process in Middleman? Adding ignore '*.swp' to the config.rb doesn't work for me.
Kotosif
  • 338
  • 3
  • 12
1
vote
2 answers

Middleman loop through files in data folder

I am trying to figure out the right syntax for calling a range of files within the /data folder. For example, I have a handful of files in /data, each formatted as article1.yml, article2.yml, etc. How might I loop through them in my template? I…
1
vote
1 answer

Middleman 4 Relative Assets Exclude Page

I'm trying to use the relative_assets extension in Middleman 4.2.1. I have one page that I need to have absolute assets on, which is my /404.html page. I found the available options listed in the source here. It looks like I should be able to pass…
Bramanga
  • 138
  • 1
  • 10
1
vote
1 answer

Middleman: choosing information from data files in frontmatter

I am using Middleman static page generator and I would like to pull information from data files based on selection made in frontmatter. Example I have data file located at data/cta.yaml with different variants of Call-To-Action text that can be…
Rafal
  • 864
  • 10
  • 21
1
vote
1 answer

How to get Middleman to get relative link for root url?

How do I get my root url to work with relative links? This tag does not seem to want to point to the right place. <%= link_to 'Home', '/' %> I can reproduce locally like this: gem install middleman middleman new site cd site echo "<%= link_to…
mehulkar
  • 4,895
  • 5
  • 35
  • 55
1
vote
1 answer

How can helpers be accessed from Middleman Console

How can helpers be accessed from middleman console? Answer for both 3.x and 4.x would be helpful if it's not the same object path.
rb-
  • 2,315
  • 29
  • 41
1
vote
1 answer

How do I speed up my middleman 4 development blog build?

My Middleman 4 site has 250 blog posts. The number of blogs makes livereload so slow as to be unusable (a change takes more than 1 minute to update) I deleted all the blog posts except for the most recent three and things are fast again, but this…
David Silva Smith
  • 11,498
  • 11
  • 67
  • 91
1
vote
1 answer

Middleman using Foundation 6

I want to use Middleman with wonderful Foundation 6. Here is a repo I've found on Middleman's website. I have Middleman installed as well as Xcode developers tools. When I run middleman init -T james-weaver/middleman-foundation-6 portfolio in my…
Kira
  • 1,575
  • 4
  • 26
  • 48
1
2 3