You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...but there isn't currently a way to add that entry through the $ bin/importmap pin command because it will always attempt to download and vendor the file through jspm:
puts%(Pinning "#{package}" to #{packager.vendor_path}/#{package}.js via download from #{url})
packager.download(package,url)
This Issue proposes an option for adding a new entry using bin/importmap pin that will not be downloaded and maintain the direct URL:
bin/importmap pin https://mycdn.com/some-package.js --from direct
Update: Thinking some more about this, I wonder if when using the CLI pin command, merely passing a value that starts with http[s]:// would result in the direct mode.
The behavior of providing a static URL does still seem to work when added to the config/importmap.rb file.
The use-case behind this is a desire to use my own js libraries that are served from their own remote host and are available upon multiple websites/projects and I'd like to update/manage them remotely without vendoring/updating/managing them within multiple individual Rails apps. Unfortunately browser imports only allow a single <script type="importmap"> ... tag per HTML page, which means that all importmap definitions would need to go through a single helper.
The text was updated successfully, but these errors were encountered:
bensheldon
changed the title
Add option to bin/importmap pin URL to create CDN direct link without downloading
Add option to bin/importmap pin URL to create direct/remote link without downloading
Feb 25, 2024
It's currently possible to "manually" add a URL to
config/importmap.rb
that will not attempt to be locally cached e.g....but there isn't currently a way to add that entry through the
$ bin/importmap pin
command because it will always attempt to download and vendor the file through jspm:importmap-rails/lib/importmap/commands.rb
Lines 15 to 19 in ddf9be4
This Issue proposes an option for adding a new entry using
bin/importmap pin
that will not be downloaded and maintain the direct URL:Update: Thinking some more about this, I wonder if when using the CLI
pin
command, merely passing a value that starts withhttp[s]://
would result in the direct mode.Update2: Oops, I overlooked the change where
pin
is now synonymous with vendoring the library. I think maybe I have two thoughts now on this:config/importmap.rb
file.<script type="importmap"> ...
tag per HTML page, which means that all importmap definitions would need to go through a single helper.The text was updated successfully, but these errors were encountered: