Open xixixao opened 10 years ago
This a request of mimosa-server and how the embedded server works? Or does it have something to do with server-template-compile?
Well, I ran into this when I wanted to serve the website statically, in which case I was using this module. I assume this isn't a problem when actually serving the website, in which case the absolute paths are preferred.
Just so I understand...
You are serving the website statically, post mimosa build and without mimosa involved, and you are using this module to compile the dynamic templates to static ones, and when you do that the paths need to be relative?
Yes.
Any updates on this, advice? I might change my skeletons that I intend to make available as static deploy, to use relative paths. But better, and I have seen this somewhere... (maybe Nette, PHP framework), is to pass in baseUrl, that could be correctly handled when you compile the templates:
link(rel='stylesheet', href='{baseUrl}css/style.css' + cachebust)
so that if a template is inside a directory, the jade gets baseUrl as ../
and in config you can set what the top url is supposed to be.
I'm traveling for work this week so I'm a little booked. One thing that would help me understand this is if you could throw together a simple app illustrating the problem. I think I get it, but don't want to advise poorly.
If the baseUrl
thing works for you, is that something you could add to serverTemplate.locals
? Modify your jade templates to take baseUrl
and pass it in?
If the baseUrl is absolute, then yes, otherwise no. (I'll try to put the app together, do subfolders in views even work?)
I don't believe subfolders work for the default server, but I may be misunderstanding the issue I put in awhile back. I may never double back to that issue. The default server isn't meant to be robust enough to handle complex cases.
Or are you talking about something else?
I'm back at mimosa 2.0 this week after a week away from it while traveling. If I get some dead time I'll take a peek at this.
Yeah, that's what I meant.
For this, it's important what people need in real situations, mine is just one use case, and then it's just about the defaults, really (nothing stops devs from changing that URL).
Not sure how, but it would be cool to point out that relative paths should be used inside views.