Ask A Question

Notifications

You’re not receiving notifications from this thread.

How can I add third party plugin in rails 6?

Siva Ganesh asked in Rails

My application.html.erb looks like this. I just want to remove all cloudfare(cdnjs) external link from application.html.erb. Instead of that I just want to use it in application.js . Because I dont want my application to get load third party plugin every time. If we used it in application.js it will compile for the first time. so my application dont get that much load.

Thanks please assist me

<!DOCTYPE html>
<html lang="en">
  <head>
    <title><%= yield(:title).present? ? yield(:title) : 'Tryblank' %></title>
    <meta name="description" content="<%= yield(:description).present? ? yield(:description) : 'Tryblank' %>" />
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
    <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.12/css/lightgallery.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.12/js/lightgallery.js" type="text/javascript"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lg-thumbnail/1.1.0/lg-thumbnail.min.js" type="text/javascript"></script>
  </head>
  <body>
    <%# <p class="notice"> notice</p> <p class="alert">alert</p> %>
    <%= yield %>
  </body>
</html>
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.