swipestripe / silverstripe-swipestripe

Ecommerce module for SilverStripe
http://swipestripe.com
33 stars 49 forks source link

Option to disable jQuery #88

Open mediaclinic opened 9 years ago

mediaclinic commented 9 years ago

Is there an option to disable jQuery loading from Swipestripe? That would be a great option in YML, as your theme might already use it and you want to load it only once.

Zauberfisch commented 9 years ago

A mechanism for this already exists in SilverStripe. you can block resources.

Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.min.js'); 

with block you can block certain files from being added. you can pretty much put those 2 lines anywhere, can be before or after the code of SilverStripe is executed. Though I would advise to put it into the init() method of the page controller.