Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Params #1532

Closed
fgarcia opened this issue May 27, 2015 · 8 comments
Closed

URL Params #1532

fgarcia opened this issue May 27, 2015 · 8 comments
Labels

Comments

@fgarcia
Copy link

fgarcia commented May 27, 2015

I have seen that in v4 the request helper method was removed

What are the alternatives to access the url params while rendering a template?

@tdreyno
Copy link
Member

tdreyno commented May 27, 2015

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?

@fgarcia
Copy link
Author

fgarcia commented May 27, 2015

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

@tdreyno
Copy link
Member

tdreyno commented May 27, 2015

Ah, cool. let me think on this

@fgarcia
Copy link
Author

fgarcia commented May 27, 2015

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.

@fgarcia
Copy link
Author

fgarcia commented May 28, 2015

@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?

@tdreyno
Copy link
Member

tdreyno commented May 28, 2015

@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

@Arcovion Arcovion added the v4 label May 28, 2015
@fgarcia
Copy link
Author

fgarcia commented May 29, 2015

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.

@tdreyno
Copy link
Member

tdreyno commented Jun 1, 2015

Ok, added as:

rack[:request]

In template/helper context.

@tdreyno tdreyno closed this as completed Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants