问题
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