Trouble importing Materialize into an Aurelia project

混江龙づ霸主 提交于 2019-12-13 04:00:04

问题


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

Materialize is imported in App.ts with import 'jspm_packages/npm/materialize-css@0.97.1/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/materialize-css@0.97.1/dist/js/picker.js 404 (Not Found)
Unhandled promise rejection Error: XHR error (404 Not Found) loading http://localhost:8000/hammerjs.js(…)

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

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)


回答1:


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

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




回答2:


The version of the materialize is 0.97.1 now.

But that have some problem I don't know why. If you really want to use, change the version to 0.97.0.

jspm install github:Dogfalo/materialize@0.97.0

Then you can find the directory and files exist.

You can use it by:

import materialize from 'Dogfalo/materialize';



来源:https://stackoverflow.com/questions/33574208/trouble-importing-materialize-into-an-aurelia-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!