Skip to content
This repository

Cannot refer to content in the public folder from HTML #196

Closed
giacecco opened this Issue June 22, 2012 · 9 comments

5 participants

Gianfranco Cecconi Avital Oliver David Glasser Jorge Pedret Andrey Melnik
Gianfranco Cecconi

I know this sounds stupid but there is no way I can reference content in the public folder, e.g. images, from the main HTML file in a Meteor application. I have tried all combinations I can imagine:

/public/foo.jpg
public/foo.jpg
/foo.jpg (like in the todo list example)
foo.jpg

and none works, nor I can find any examples in the documentation of what I am supposed to do. Of course foo.jpg exists.

The docs also say: "(...) Meteor server will serve any files under the public directory, just like in a Rails or Django project", so I've tried using Djiango's {{ STATIC_URL }}, but of course it does not work, too. What am I missing?

Thanks,

G.

Gianfranco Cecconi

Still no progress with this. I have posted the issue also on Stack Overflow here, with step by step instructions to reproduce it from a vanilla meteor project.

Jorge Pedret

I'm experiencing the same problem but with my font files. It was working properly in my iMac where I started the project, then I moved the files to my MacBook Pro and it's not serving the files properly.

Please let me know if there's anything I can do to help solve this issue.

This is the error that I'm getting from the developer tools: "Resource interpreted as Font but transferred with MIME type text/html: "http://localhost:3000/css/fonts/Chunkfive-webfont.woff"."

Jorge Pedret

Just found out what the problem was. It was totally my fault. The path to the file was wrong, it was /css/fonts/Chunkfive-webfont.woff instead of /fonts/Chunkfive-webfont.woff.

Still I think the server should return a 404 response, instead of a 200. Everything works fine now though.

Gianfranco Cecconi

Thanks Jorge. For everybody: this conversation is still developing on Stack Overflow, too. So far I have demonstrated that the same application works correctly on another Mac, which would apparently relate the issue to some strange web server issue in Meteor that depends on the host's configuration.

Andrey Melnik

If your path has spaces in it (e.g. you external volume name is "External HD" of project name have spaces) then static middleware (https://github.com/senchalabs/connect/blob/master/lib/middleware/static.js#L56) fails to parse fullpath

for example
"/Users/dru/git/svitto test/.meteor/local/build/static/images/logo.png"
parsed as
"/Users/dru/git/svitto"

David Glasser
Owner

dru, is this a bug in static? Should it be reported to that project?

Avital Oliver avital closed this September 17, 2012
Avital Oliver
Owner

I think @glasser is suggesting that this is a bug in connect. I am closing this (if anything, the real bug is that spaces in static asset filenames aren't supported)

Avital Oliver avital reopened this September 17, 2012
Avital Oliver
Owner

We should try to find a way to submit a patch if necessary and/or work around it.

David Glasser
Owner

I tried to reproduce @dru 's bug but couldn't. Closing.

David Glasser glasser closed this September 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.