Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import jQuery Plugin with JSPM

I'm trying to import the jQuery plugin jQuery.scrollTo with JSPM.

So far I installed it with

jspm install npm:jquery.scrollto

and now I'm trying to import it with

import $ from 'jquery';
import scrollTo from 'jquery.scrollto';

Now I'm only getting

$(...).scrollTo is not a function

errors.

I tried to shim it, but I never did it before and can't find a good explanation how to do it, if it is necessary. Can you help me or show me a good explanation when and how do I need to shim things?

like image 568
Simon Knittel Avatar asked Jun 16 '15 13:06

Simon Knittel


1 Answers

I tested on a clean project and here are the steps that i followed:

  1. jspm install jquery

  2. jspm install npm:jquery.scrollto -o "{format: 'global'}" - (see this answer)

  3. add the imports in my app.js as described in the question.

  4. tested both from dev mode and from a self executing bundle with no errors.

You can clone a test repo I've put up here on Github, the steps to build are in the readme. Hope this helps.

like image 105
Aurelio Avatar answered Oct 11 '22 18:10

Aurelio