We're using Middleman with HAML.
The site we're building should support multiple themes, and themes' markup differs from from one theme to another and we're using some variables to configure each theme.
I'm looking for a way to have Middleman to repeat the build for each theme I need with its variable values.
I would recommend using a variable within config.rb, e.g.:
set :theme, ENV['THEME'] || 'red'
That way you can access it within your templates using settings.theme:
%p Current theme is #{content_tag(:strong, settings.theme)}.
Which should prompt: "Current theme is red."
Now the fun part, invoking ...
# on a linux/unix shell
THEME='blue' middleman build
# on a windows shell
set THEME=red & middleman build
... or ...
# on a linux/unix shell
THEME='yellow' middleman build
# on a windows shell
set THEME=yellow & middleman build
... via the shell sets ENV['THEME'] e.g. your theme name and should bring you the different themed builds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With