> How are other getting around this? Are there better ways to deal with this?
We're using middleman to produce static websites (so the front end devs can do
all their stuff as they want), and then add the lein cljsbuild files over the
top with suitable output directories set in project.clj.
To choose between prod/dev when generating the static site, we have a block
like:
<% unless prod_mode? %>
<%= javascript_include_tag "react-with-addons-0.9.0.js" %>
<%= javascript_include_tag "goog/base.js" %>
<% end %>
<%= javascript_include_tag "your-app" %>
<% unless prod_mode? %>
<script
type="text/javascript">goog.require("your_site.some_file");</script>
<% end %>
Then there's some hackerage in middleman to set the flag prod_mode? based on
the environment (as a custom middleman extension), and then build prod or dev
with:
TARGET=dev bundle exec middleman build && lein cljsbuild once dev
or for production, remove the TARGET and change the call to lein.
it's a massive PITA, and I actually like some of the other answers in this
thread more, but works for us.
The middleman extension is this for completeness
class ProdModeFeature < Middleman::Extension
option :prod, true, 'Controls whether we are in prod mode or not'
def initialize(app, options_hash={}, &block)
super
end
helpers do
def prod_mode?
opts = extensions[:prod_mode].options
return opts.defines_setting?(:prod) ? opts.prod : true
end
end
end
::Middleman::Extensions.register(:prod_mode, ProdModeFeature)
case ENV['TARGET'].to_s.downcase
when 'dev'
activate :prod_mode, :prod => false
else
activate :prod_mode
end
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.