Materialize: Hammerjs not found

Created on 4 Feb 2015  Â·  9Comments  Â·  Source: Dogfalo/materialize

I use require.js and materialize.js v0.95.1, and it reports Uncaught Error: Script error for: hammerjs.
It seems that you use the jquery.hammer.js which has a dependency with hammerjs.js, but the dependency is not included in the release file.

Most helpful comment

When I was using materialize.js for my html in an electron project, the browser showed me with Uncaught ReferenceError: Hammer is not defined. Wonder what I can do to fix this?

I tried to use require('path-to-materialize.js') as I did for jQuery, but it didn't help.

Perhaps the same problem with https://github.com/Leko/revy/issues/14

Seems that my problem has nothing to do with this one...

Mine was fixed in https://github.com/atom/electron/issues/1655


I required 'hammer' manually and fixed.

Added

window.$ = window.jQuery = require('../assets/jquery/jquery-2.1.4.min.js');
window.Hammer = require('../assets/hammer/hammer.min.js');

All 9 comments

we have the minified file in the distribution.
hammer.min.js

dist/js/materialize.js has no hammer.min.js.
I have to download and import it manually, that means

<script src="scripts/lib/hammer.min.js"></script>
<script src="scripts/lib/materialize.min.js"></script>

Why not concat the file into the distribution?

It is already
On Feb 4, 2015 10:09 PM, "寿寿" [email protected] wrote:

dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
has no hammer.min.js.
I have to download and import it manually, that means

Why not concat the file into the distribution?

—
Reply to this email directly or view it on GitHub
https://github.com/Dogfalo/materialize/issues/613#issuecomment-72986957.

I am sorry, but which line defines the Hammer in dist/js/materialize.js?

Line 213. you can also see in the Gruntfile.js that it is being included. And if you search any of the text from js/hammer.min.js, you will see that it is also found in dist/js/materialize.js

When I was using materialize.js for my html in an electron project, the browser showed me with Uncaught ReferenceError: Hammer is not defined. Wonder what I can do to fix this?

I tried to use require('path-to-materialize.js') as I did for jQuery, but it didn't help.

Perhaps the same problem with https://github.com/Leko/revy/issues/14

Seems that my problem has nothing to do with this one...

Mine was fixed in https://github.com/atom/electron/issues/1655


I required 'hammer' manually and fixed.

Added

window.$ = window.jQuery = require('../assets/jquery/jquery-2.1.4.min.js');
window.Hammer = require('../assets/hammer/hammer.min.js');

@imcaffrey I confirm it works by adding hammer.min.js. I used <script src="scripts/hammer.min.js"></script> instead of require because the latter didn't work.

@kalpetros Thanks for informing, require worked on my electron project, don't quite know your condition.

Why is this issue closed? I just loaded materialize and I get the hammer-not-defined error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acierpinski picture acierpinski  Â·  3Comments

samybob1 picture samybob1  Â·  3Comments

djensen47 picture djensen47  Â·  3Comments

Robouste picture Robouste  Â·  3Comments

ReiiYuki picture ReiiYuki  Â·  3Comments