流星图像,CSS,“正常”网络服务 [英] Meteor Images, CSS, "Normal" Web Serving

查看:125
本文介绍了流星图像,CSS,“正常”网络服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到这个问题出现了很多;

I've seen this question come up a lot;


  • 如何将图像放在我的Meteor网站上?

  • 如何使用Meteor托管标准网页内容?

  • 我尝试添加< img src =img / myimage。 png> 标签,但没有图片显示!

  • 如何在Meteor网站上托管一些文件?

  • 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?

推荐答案

将内容放在项目根目录中名为public的文件夹中。


  • 您无需在网址中加入/公开。

  • 支持公开内容中的任何其他文件夹结构。

  • 不需要NodeJS路由插件,因为提供了其他答案。

  • 将外部库的javascript文件放在/ lib中。它们将自动包含在内。

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

解释

在Meteor中,您可以通过在项目根目录中创建公共目录来托管标准Web内容。您放置在此文件夹中的任何图像,文件或数据都将由NodeJS服务器正常提供,就好像它们位于服务器的根目录中一样。

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


  • 项目内的结构: /public/test/img.png

  • 对应的图片网址: /test/img.png

  • 示例HTML标记:< img src =/ test / img.png/>

  • Structure within project: /public/test/img.png
  • Corresponding image URL: /test/img.png
  • Example HTML tag: <img src="/test/img.png"/>

这篇关于流星图像,CSS,“正常”网络服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆