javascript - Rails: Include Javascript_include_tag outside default folders -
i have template i'm trying include on rails aplication. template has it's own structure don't want mess with. lets call template "material".
i've put files under my vendor/assets folder, have structure:
railsapp/vendor/assets/material/material inside last "material" folder, have folders js , css. way i've created file "material.js" includes:
//= require material/js/jquery-2.1.1 //= require material/js/functions //= require material/js/bootstrap so can call js want.
here problem: how can call material.js application.html.erb ?
<%= javascript_include_tag '/vendor/assets/material/material/material', 'data-turbolinks-track' => true %> does not work...
thanks in advance.
i create new js file, let's material.js. in app/assets/javascripts/material.js:
//= require material/material
then in config/application.rb, need add:
config.assets.paths << rails.root.join('vendor', 'assets', 'material').
you need add material.js pre-compile list. in config/initializers/assets.rb:
rails.application.config.assets.precompile += %w( material.js ).
and in view, can reference material:
javascript_include_tag 'material'
Comments
Post a Comment