solidusjs / solidus

A simple server that generates pages from JSON and Templates
MIT License
28 stars 7 forks source link

Allow relative URLs in resources #50

Open pushred opened 11 years ago

pushred commented 11 years ago

Sometimes it may be helpful to store static JSON data in a site's repo and access it in templates. For example I might have this file: /data/lipsum.json. I'd like to be able to access it from my templates with /data/lipsum.json but currently Solidus is telling me this is invalid:

[SOLIDUS] Error retrieving resource "lipsum": [Error: Invalid URI "/data/lipsum.json"]

Requiring the server's full host to support this is dangerous because it's environment-specific.

Fauntleroy commented 11 years ago

Forgive me if I'm wrong, but aren't you against storing data like this inside the site itself?

pushred commented 11 years ago

I think there's definitely utility in that, allowing Solidus to work somewhat like a static site generator. For example you could add a step in your Gruntfile to convert Markdown files into JSON objects you could use on your site for static content. Static JSON content is a common feature in the static site generator frameworks out there like Middleman, Roots, Wintersmith, Mixture.io, etc. Our pages aren't compiled to HTML when deployed so we're not a static site generator, but I can see the value of being able to mix in some static resources alongside dynamic content.

pushred commented 11 years ago

@Fauntleroy Can you expedite this? Would make the Solidus stuff @monikahoex is working on much easier.

Fauntleroy commented 11 years ago

I don't consider this to be a feature worth adding, considering our ideas about pulling in data from third parties. Why not just put this data elsewhere and pull it in?

pushred commented 11 years ago

Because that requires uploading the data somewhere else. If it's local static data why bother with that?

Fauntleroy commented 11 years ago

If it's local static data I don't see why it's being put into JSON at all. Why not just write it as static markup? What exactly is the use case for this?

pushred commented 11 years ago

Because writing documentation with code examples as static markup is painful. I'm no weirdo, why do you think so many static site generators exist?