I have a template that I'm trying to include on my Rails Aplication. This template has it's own structure that I don't want to mess with. Lets call this template "material".
I've put all the files under my vendor/assets
folder, so that I have this structure:
railsApp/vendor/assets/material/material
Inside this last "material" folder, I have the folders with my JS and CSS. This way I've created a file "material.js" that does the includes:
//= require material/js/jquery-2.1.1
//= require material/js/functions
//= require material/js/bootstrap
so that I can call the js that I want.
Here is my problem:
How can I call this material.js from my application.html.erb
?
<%= javascript_include_tag '/vendor/assets/material/material/material', 'data-turbolinks-track' => true %>
Does not work...
Thanks in advance.
I would create a new js file, let's say
material.js
. Inapp/assets/javascripts/material.js
://= require material/material
Then in your
config/application.rb
, you need to add:config.assets.paths << Rails.root.join('vendor', 'assets', 'material')
.You would also need to add
material.js
to the pre-compile list. Inconfig/initializers/assets.rb
:Rails.application.config.assets.precompile += %w( material.js )
.And then in your view, you can reference material:
javascript_include_tag 'material'