Closed fgarcia closed 9 years ago
Well, static websites don't have a means of reading the url, outside of Javascript. I'd caution against it, as it would only work in dev mode and hosting a dev mode site isn't going to be very fast. What is your use case?
Although I also just dump static content, most of my pages render extra sections with notes, ideas and some info ala rails footnotes... that are only visible in development.
Mostly I just wanted an easy way to switch between the development and production rendering by adding en environment variable
Ah, cool. let me think on this
I find convenient having production?
and development?
helpers globally which are affected by some url param like env=production
However since I use dnsmasq for custom dev domains, I am starting to think that it would be even more convenient using a prod/dev subdomain. That way I could easily switch the middleman server environment in a way that persists after clicking on links.
@tdreyno I will not change the topic of this issue, but I have been exploring using subdomains instead url params. This is my ideal setup to access middleman:
mysite.dev (defaults to development mode) production.mysite.dev development.mysite.dev build.mysite.dev
Is there any easy hack to access the domain so I can build my env helpers around them?
@fgarcia That's the primary question. Should we expose our web server environment to Middleman, like we did in v3. I think you've convinced me, but I need to think about the API
if missuse is an issue, what about exposing it only to extensions?
That way people will think twice about the reasons of not being exposed in the normal environment along other helpers.
Ok, added as:
rack[:request]
In template/helper context.
I have seen that in v4 the
request
helper method was removedWhat are the alternatives to access the url params while rendering a template?