Meteor 允许访问 cdn - 路由器的 public 图像文件夹

Metor allowing access to the public images folder for a cdn - router

我试图让 CDN 访问我的图像和 css,我认为我们的路径被我的路由器劫持了。

Router.route('/:permalink', function () {
  this.render('item', {
      // path: '/:permalink',
    data: function(){
        var permalinkVar = this.params.permalink;

        return Items.findOne({permalink: permalinkVar});
      },
    });

});

有没有办法让 /images /css 和 /js 等路径免于这条路线?

将任何您想要 public 公开的内容放入 public 文件夹中。来自流星文档 (http://docs.meteor.com/#/full/structuringyourapp):

public

All files inside a top-level directory called public are served as-is to the client. When referencing these assets, do not include public/ in the URL, write the URL as if they were all in the top level. For example, reference public/bg.png as <img src='/bg.png' />. This is the best place for favicon.ico, robots.txt, and similar files.

因此,如果您在 /public/images/image1.png 中有图像,则可以在 yourdomain/images/image1.png.

中访问它