本文介绍了忽略 Meteor JS 项目目录中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 JavaScript 的库,我想包含在 Meteor JS 应用程序中.库源代码托管在 Git 存储库中,我想将该存储库作为子模块包含在我自己的 Meteor 应用程序的源代码存储库中.但是,我不需要 Meteor 处理的大部分文件,只需要少数几个选择的文件.事实上,当流星看到子模块中的许多文件时,它会显示错误:无法解析 .. 嗯 .. 一些 HTML 文件,在某些行上.抱歉".

I have a JavaScript based library I'd like to include in a Meteor JS application. The library source code is hosted in a Git repository and I'd like to include the repo as a submodule in my own source code repo for my Meteor app. However, I don't need a majority of the files included processed by Meteor, only a few select ones. Indeed Meteor barfs with "Error: Couldn't parse .. um .. some HTML file, on some line. sorry" when it sees many of the files in the submodule.

有没有办法有选择地将文件列入白名单或黑名单以包含在项目目录中的 Meteor 应用程序中?除了创建智能包之外,还有什么方法可以在我的 Meteor 应用程序项目目录中包含外部资源,例如 Git 子模块.

Is there a way to selectively whitelist or blacklist files for inclusion into the Meteor app inside the project directory? Apart from creating a Smart Package, are there ways in which I could include external resources such as Git submodules inside my Meteor app project directory.

更新:如如何创建包",如果您在 Meteor 本身的本地 Git 检出中创建一个智能包,您将获得包中代码的热重载行为.

Update: as explained in the related question of "How to create a package", if you create a Smart Package into a local Git checkout of Meteor itself, you get the hot-reload behaviour for the code in the package.

推荐答案

除了乔纳森提到的 /public 目录外,Meteor 还会忽略任何以."开头的目录.- 所以你可以创建一个 .submodules 目录并将文件放在那里,Meteor 不会加载它们.

In addition to the /public directory that jonathan mentions, Meteor also ignores any directories that begin with a "." - so you could create a .submodules directory and put the files in there and Meteor won't load them.

这可能比将它们放在 /public 中更可取,因为它们不是公开的.

This is probably preferable to having them in /public since, well, they're not public.

这篇关于忽略 Meteor JS 项目目录中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

查看更多