-
Notifications
You must be signed in to change notification settings - Fork 34
viewdocs.io should serve template support files (js, css, json, appcache) #21
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
Comments
According to @progrium's comment on #9 (comment), I risk saying this is "out of scope" in order to keep things simple on this project :-) A workaround is to use GitHub pages to serve those assets. As per serving image files, I haven't tried it yet but my "gut feeling" tells me that unfortunately it won't work as well. If you end up trying it out please let us know how it goes! |
Try using this: https://rawgithub.com/ On Thu, Jan 2, 2014 at 2:05 PM, Fabio Rehm [email protected] wrote:
Jeff Lindsay |
Please don't do that! |
Ah right. I forgot I only use it for local dev stuff. Scratch that On Thu, Jan 2, 2014 at 2:22 PM, Fabio Rehm [email protected] wrote:
Jeff Lindsay |
I can use github pages to serve static assets, a hassle, but once the template is stable, it won't need to be touched. Having to rely on that for content embedded image files is more problematic, but still workable, as I expect them to be few and far between. The same origin issue for json files still exists -- I can live with my current work-around for that, I guess, but I'd prefer otherwise. |
Because of the caching viewdocs does and assumptions around Heroku that However, if we can come up with an easy solution to use GH Pages... maybe On Thu, Jan 2, 2014 at 2:34 PM, MarFarMa [email protected] wrote:
Jeff Lindsay |
Some iteration of this perhaps: http://jakebresnehan.com/post-commit-hook-for-github-pages/ Or actually, more like this: https://gist.github.com/Rich-Harris/6207294 - force gh-pages branch to match master and push both branches to origin at once -- now how to configure gh-pages to serve assets from the docs directory -- hopefully trivial, but ... |
And .... the answer is, if you can see this file, http://marfarma.github.io/angular-pouch-model/docs/assets/css/demo.css it's working. OK - it's a simple one-time setup, with all work local to your repository. Don't follow Start with an current clean repository, on the master branch. It's easiest to work from
add a file,
make it executable
edit your
this way, when you Tell Github that you are not using Jekyll
Check in your changes and push to origin, adding the gh-pages branch to Github:
Wait ten minutes for Github to notice your new gh-pages branch and start serving your files. Now, in your templates you can reference:
assuming you created a file |
This is great. Would you be interested in porting this to a page in the viewdocs docs directory? |
It should ideally be part of a longer document covering how to write templates. I'll throw something together as a first pass, maybe tonight. |
Correction - http://{{user}}.github.io/{{name}}/docs/assets/css/demo.css doesn't work. Template rendering doesn't replace |
yes, thanks On Thu, Jan 2, 2014 at 9:35 PM, MarFarMa [email protected] wrote:
Jeff Lindsay |
The pull request was merged: http://progrium.viewdocs.io/viewdocs/custom-layouts There are a few minor issues, principal among them that the {{USER}} and {{NAME}} tags were rendered. Is there any way to prevent them from being rendered - back ticks, code tags? There needs to be a link to it from the main index.md page, once the issues have been cleaned up. |
See pull request #27 for template tag escaping. |
FTR: Apparently https://rawgithub.com/ turned into https://rawgit.com/ and they now say it can be used for production! |
Currently attempting to link to http://{{user}}.viewdocs.io/{{name}}/assets/app.js returns 404 - file not found. Github's anti-hot-linking provision prevents the use of http://raw.github.com/{{user}}/{{name}}/docs/assets/app.js As a workaround I've added my script code to my template using a script tag. The same issue exists for css and json files. While that's not too bad, what's really awful is that I've had to do the same with my customized bootstrap.css - add it to the head in a style tag.
And while json files don't suffer from Github's anti-hot-linking provision - they are subject to same-origin restrictions via ajax access - leading me to embed json in a markdown file, and then parse it out from the rendered template after it's fetched from the server. This is further made difficult by the attribute stripping from markdown included html - see my other issue.
Are image files served? I haven't tested that yet. If not, and they can't be hot-linked, they should also be supported.
If security is a concern, perhaps enforce that non-markdown files served must be included in a manifest file at the same location as the template (whether or not the template includes a manifest tag), or only server files local to the docs directory and it's children?
The text was updated successfully, but these errors were encountered: