Build vs. Server variable for code block logic?

Let say I write in Haml. Then I either run as a server to view that haml page in the browser or use build to write the results in /build folder. I want to change the script .js name in the build. Is there a way to tell Middleman to hide/show certain code block whether it’s running as server or build?

Something like this:

{if servermode then}
Code block A
{ else }
Code block B
{ endif }

(I just made that up as Python template can do that)

- if development?

and

- if build?

@tommysundstrom Nice thank you

Also see http://middlemanapp.com/advanced/configuration/#toc_4