Is it possible to make this work without npm but with importmap #2135
-
Hello :) I am pretty new to javascript, i have a rails 7 that does not have npm or yarn installed and that is for now only using importmaps. I would like to use the primer CSS to support the view components. Is it possible to have primer/css without npm, only using importmaps ? Thank you so much for your help, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey @troptropcontent, interesting question! I have personally never used import maps before, but after reading a bit about them I think primer/view-components should work with them. Try putting something like this in config/importmap.rb: pin "@primer/view-components", to: "https://ga.jspm.io/npm:@primer/[email protected]/app/assets/javascripts/primer_view_components.js" As for the CSS from primer/view-components and primer/css, you should be able to pull them in directly using <link rel="stylesheet" href="https://unpkg.com/@primer/[email protected]/app/assets/styles/primer_view_components.css" crossorigin="" />
<link rel="stylesheet" href="https://unpkg.com/@primer/[email protected]/dist/primer.css" crossorigin="" /> |
Beta Was this translation helpful? Give feedback.
Hey @troptropcontent, interesting question! I have personally never used import maps before, but after reading a bit about them I think primer/view-components should work with them. Try putting something like this in config/importmap.rb:
As for the CSS from primer/view-components and primer/css, you should be able to pull them in directly using
<link>
tags: