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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -