ruby-on-railsruby-on-rails-6webpackerinspinia

How to integrate inspinia into rails 6


My problem is with the inspinia.js file in rails 6.

I have the file inspinia.js and application.js in :-

app / javascript / pack

Try to integrate it in the following ways:

import 'inspinia'
require ("inspinia")

and in some other ways that didn't help me either. If someone has already done it or knows how to do it, I would appreciate your help.


Solution

  • Well, you said that you've put it in the app/javascript/packs directory. All you have to do is require it in application.js like:

    require ("packs/inspinia");
    
    

    You can also include it in the the index.html.erb like:

    <%= javascript_pack_tag 'inspinia', 'data-turbolinks-track': 'reload'  %>