Christian Stewart
Christian Stewart

Reputation: 15519

Meteor Images, CSS, "Normal" Web Serving

I've seen this question come up a lot;

Upvotes: 15

Views: 11974

Answers (2)

Sanath Kumar
Sanath Kumar

Reputation: 237

Create a new folder public inside the project directory. Add a new folder img (or any other name of your choice) inside the public folder. Copy all the images that you require to be added in to your HTML into this folder.

Now you can use it like - <img src="img/myimage.png">

You don't need to include /public in the in the URL.

Upvotes: 0

Christian Stewart
Christian Stewart

Reputation: 15519

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

Upvotes: 45

Related Questions