Webby blog resources

5 views
Skip to first unread message

David Jacobs

unread,
Mar 21, 2010, 8:12:39 PM3/21/10
to webby...@googlegroups.com
The blog I'm designing is in HTML5 and my images are SVG.

I've been coding without using the web server, choosing to load my HTML output files directly into my browser. The SVG images and CSS files have worked great. They are in the /output/images and /output/stylesheets directories and link correctly from /output/index.html.

However, with a blog structure, I need to use an absolute URL starting with a slash to properly reference my resources from wherever. I changed all image references to "/images/my-file.svg", and CSS references to "/stylesheets/screen.css", for example.

Now, when I view my blog pages via the Webrick server, the pages are *styled* correctly but the images do not show up. What's stranger is that if I right click and "copy image address", then paste it into the browser address bar, the image shows up!

What am I doing wrong here? Is this a Webrick issue? Or general issue relating to serving the files?

I'm using Safari 4.0.5 in OS X 10.6.2, if that helps.

Regards,
David

aimee daniells

unread,
Mar 21, 2010, 9:04:02 PM3/21/10
to webby...@googlegroups.com

I recommend you use the 'webby autobuild' command - it brings up a webrick server and a lot of those relative path issues go away.

Also, in case you didn't realise, all your files including stylesheets and images should be in your content directory. Leave it to the autobuild or rebuild to copy them to output.

I think you may well be doing all this, but perhaps something I said will provide the key to finding the answer.

aimee

To unsubscribe from this group, send email to webby-forum+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

David Jacobs

unread,
Mar 21, 2010, 9:06:30 PM3/21/10
to webby...@googlegroups.com
Hi Aimee,

Thanks for your response. Unfortunately, I'm using autobuild already (that's what I was referring to when I said I was using a server) and am not manipulating my compiled files at all. Just the ones in the /content directory.

Any other clues as to why this could be happening?

David

David Jacobs

unread,
Mar 21, 2010, 11:34:29 PM3/21/10
to webby...@googlegroups.com
Hi Aimee,

I did a little digging and found a solution.

It turns out Webrick returns the wrong MIME type for SVG files. (I'm not sure why.) For a temporary fix, I patched my local /usr/lib/ruby/1.8/webrick/httputils.rb file, by adding "svg" => "image/svg+xml" to the DefaultMimeTypes hash.

I'm not sure why this was an issue, but I figured it will be more important as more people adopt vector graphics and HTML5. I'll file a bug with the Webrick devs and see what they say.

Thanks again for your help,
David

On 21 Mar 2010, at 9:04 pm, aimee daniells wrote:

Reply all
Reply to author
Forward
0 new messages