2

In Middleman, I can specify that I want to yield a partial located in a specific directory by using

= partial "partials/imports/js"

I'd like Middleman to know in which directory my partials reside. How do I modify config.rb so that I can just use = partial "js"?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Walrus the Cat
  • 2,314
  • 5
  • 35
  • 64
  • Welcome to Stack Overflow. Instead of tacking a tag to the front or end of your question's title, where it hangs completely outside the flow of the sentence, either work it into the flow of the sentence or rely on SO's built-in tags. It's not necessary to name "Middleman" in the title as the tags are used by the search engines and by SO to help people find the question. – the Tin Man Apr 20 '15 at 16:37

1 Answers1

4

You can change the default partials directory by using set in your config.rb like this:

set :partials_dir, 'partials/imports'
Aris FM
  • 176
  • 5
  • 1
    Thanks, can you add multiple directories? e.g. `'partials', 'partials/imports'` – Walrus the Cat Apr 21 '15 at 16:34
  • I don't think it's possible to set multiple directories, why don't you just create sub-directory inside partials? – Aris FM Apr 22 '15 at 03:46
  • Done, thanks! If you would, take a look at http://stackoverflow.com/questions/29752830/rendering-partials-within-partials-in-middleman?noredirect=1#comment47644292_29752830 . – Walrus the Cat Apr 22 '15 at 17:32
  • 3
    As of Middleman v4: "Removed partials_dir config option. Please reference all partials from the source/ directory. partial 'partials/my-partial' would map to source/partials/_my-partial.erb." – counterbeing Mar 19 '16 at 23:18