Search code examples
spree

Adding JS to spree


This may seem as a simple question, but I've been at it for days!

I'm trying to add external forms of JS to my spree app.

  • I've tried adding them in ass links, but they get rejected, because it's not over https

  • I've tried copying the code and pasting it to files, that are inside the /app/assets/stylesheets/store/ folder

  • I've tried adding all the code (to test it out) into the all.js file

but all methodes have failed.

Can some one explain to me how i can add Tweenmax, Jquery and other forms of JS to my app?

With kind regards,

Salman

ps:

I've checked numerous pages, as:

Javascript/Jquery not working in Spree

Adding custom cient-side form validations to Spree frontend

Including js file in spree application

http://guides.spreecommerce.org/developer/asset.html


Solution

  • To add Custom JS to spree you have to go to config/initializers/assets.rb and add the following line Rails.application.config.assets.precompile += %w( scripts/script.js )