shim a jquery module as an amd module

shim a jquery module as an amd module

by Ben Kelada -
Number of replies: 0

Is there a way to include a non-amd jquery module as an amd module for a block?

without physically changing the file into an amd module?

e.g.

{code}

https://github.com/1000hz/bootstrap-validator/blob/master/js/validator.js

trying to use this

requirejs.config({
   
paths: {
       
"validator": '/blocks/myblock/javascript/validator',
    },
   
shim: {
       
'validator' : {deps: ['jquery']}
    }
});

define(['jquery', 'validator'], function($, validator) {

// validator available in this scope

});

{code}

i've managed to shim something in a theme, but it seems a bit differen as the above doesnt work


Average of ratings: -