Including js file in spree application

我的未来我决定 提交于 2019-12-12 03:08:41

问题


I was trying to include my slider.js file to spree application but it is not working. I have looked and found that we must include it manually in all.js file but its not working.

I include in my all.js file:

//= require store/spree_core
//= require store/spree_auth
//= require store/spree_api 
//= require store/spree_promo
//= require store/slider.js

But i am not sure if the slider.js file is included in all.js file. Is there any method to test it.


回答1:


By default spree app inlcudes all css files in spreesite/app/assets/stylesheets/store/all.css by *= require_tree .
And js files spreesite/app/assets/javascripts/store/all.js the same *= require_tree .
If you need to add stylesheet or js just put the file in spreesite/app/assets/stylesheets/store folder.
Spree automatically includes them.

If js file still doesn't work try rake assets:precompile




回答2:


There's a decent chance you precompiled your assets. Try clearing them out, using the following:

bundle exec rake assets:clean


来源:https://stackoverflow.com/questions/9662116/including-js-file-in-spree-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!