本文介绍了无法将Materialize导入Aurelia项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试导入materialize-css库以用于aurelia项目.

I'm trying to import the materialize-css library for use in an aurelia project.

Materialize使用import 'jspm_packages/npm/[email protected]/dist/js/materialize.min'导入到App.ts中,但这会导致项目在加载时失败,并出现以下错误:

Materialize is imported in App.ts with import 'jspm_packages/npm/[email protected]/dist/js/materialize.min', but this causes the project to fail on load with the following errors:

GET http://localhost:8000/hammerjs.js 404 (Not Found)
GET http://localhost:8000/jspm_packages/npm/[email protected]/dist/js/picker.js 404 (Not Found)
Unhandled promise rejection Error: XHR error (404 Not Found) loading http://localhost:8000/hammerjs.js(…)

通过在项目根目录上运行jspm install npm:materialize-css来安装

Materialize.如何使导入工作?

Materialize was installed by running jspm install npm:materialize-css on the project root. How can I get the import to work?

注意:我完全希望按照此问题的答案中的说明实现自定义的实现属性:使用materializecss与aurelia .不幸的是,我无法使该问题中描述的安装/导入方法正常工作(运行jspm install github:dogfalo/materialize仅创建少数空文件夹)

NOTE: utlimately I want to implement custom materialize attributes as described in the answer to this question: Using materializecss with aurelia. Unfortunately, I can't get the install/import methods descibed in that question to work (running jspm install github:dogfalo/materialize only creates a handful of empty folders)

推荐答案

我的导入语句不正确.使用import materialize from 'materialize-css';可以正常工作.

My import statement was incorrect. Using import materialize from 'materialize-css'; works without error.

这是通过jspm install npm:materialize-css安装的实现. (在撰写本文时,版本为0.97.2)

This is with materialize installed via jspm install npm:materialize-css. (version 0.97.2 at time of this post)

这篇关于无法将Materialize导入Aurelia项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 19:52