Skip to content
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

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

Closed
giacecco opened this issue Jun 22, 2012 · 9 comments
Closed

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

giacecco opened this issue Jun 22, 2012 · 9 comments

Comments

@giacecco
Copy link

giacecco commented Jun 22, 2012

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.

@giacecco
Copy link
Author

giacecco commented Jul 4, 2012

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.

@jorgepedret
Copy link

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"."

@jorgepedret
Copy link

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.

@giacecco
Copy link
Author

giacecco commented Jul 9, 2012

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.

@dru
Copy link

dru commented Sep 3, 2012

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"

@glasser
Copy link
Contributor

glasser commented Sep 5, 2012

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

@avital
Copy link
Contributor

avital commented Sep 17, 2012

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 avital closed this as completed Sep 17, 2012
@avital avital reopened this Sep 18, 2012
@avital
Copy link
Contributor

avital commented Sep 18, 2012

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

@ghost ghost assigned avital Sep 18, 2012
@glasser
Copy link
Contributor

glasser commented Sep 25, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants