[英]Best way to load a globally usable library in jspm
I am new to jspm. 我是jspm的新手。 I want to use materialize-css
in my project. 我想在我的项目中使用materialize-css
。 I think the ideal way of using it is that after installing with jspm ( jspm install npm:materialize-css
) using it must be something like this (in my index.html
): 我认为使用它的理想方法是在使用jspm( jspm install npm:materialize-css
) jspm install npm:materialize-css
后,使用它的方式一定是这样的(在我的index.html
):
System.import("materialize-css");
System.import("app");
The question is what is the proper way of importing and using a library that is globally usable in all of my application and have css and javascript? 问题是导入和使用可在我的所有应用程序中全局使用并且具有CSS和javascript的库的正确方法是什么? Such as bootstrap
, material-design-lite
or materialize-css
. 例如bootstrap
, material-design-lite
或materialize-css
。
I think if you want to access the lib via the global/window object then you could import it in the index.html like you described it. 我认为,如果您想通过global / window对象访问该库,则可以像描述的那样将其导入index.html中。 But you should make sure that it is loaded before you import your app module: 但是,在导入应用程序模块之前,应确保已加载它:
System.import("materialize-css").then(() => {
System.import("app");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.