Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor Images, CSS, "Normal" Web Serving

I've seen this question come up a lot;

  • How do I put images on my Meteor website?
  • How do I host "standard" web content with Meteor?
  • I tried adding a <img src="img/myimage.png"> tag but no image shows!
  • How can I host some files on a Meteor site?
like image 541
Christian Stewart Avatar asked Mar 01 '13 20:03

Christian Stewart


1 Answers

Put the content in a folder named "public" in your project root.

  • You do not need to include /public in your URLs.
  • Any additional folder structure within public is supported.
  • NodeJS routing plugins are not required, as other answers have supplied.
  • Place external library's javascript files in /lib. They will be automatically included.

Explanation

In Meteor, you can host "standard" web content by creating a "public" directory in the root of your project. Any images, files, or data you place in this folder will be served as normal by the NodeJS server, as if they were in the root of the server.


Example

  • Structure within project: /public/test/img.png
  • Corresponding image URL: /test/img.png
  • Example HTML tag: <img src="/test/img.png"/>
like image 122
4 revs, 3 users 95% Avatar answered Oct 15 '22 19:10

4 revs, 3 users 95%