ruby on rails - How to get static link from assets pipeline -
i new in rails , still got stuck @ link javascript file. using bower rails install xdlocalstorage , after installed, received folder xdlocalstorage @ vendor/assets/bower_component.
in app/assets/javascript/xdlocalstorage/application.js:
//= require xdlocalstorage //= require_tree . in config/initializers/assets.rb
rails.application.config.assets.precompile += %w( xdlocalstorage/application.js ) now, want url file in xdlocalstorage. not. had tried follow:
= asset_url 'xdlocalstorage/dist/scripts/xdlocalstorage.min.js' but return 404.
some people ask me why have url. xdlocalstorage.min.js not using website, embed on website , dynamically load jquery. need url file.
and people ask me why not move xdlocalstorage public folder. because need able upgrade xdlocalstorage bower easier.
please me above url. rails version: 4
there's no xdlocalstorage/dist/scripts/xdlocalstorage.min.js because not precompiled. if need - add rails.application.config.assets.precompile, or make separate manifest , add assets.precompile
also take account, link change due asset fingerprinting, give link out may need controller action redirect actual one.
Comments
Post a Comment