marten_importmap
Version, currently 0.1.13 versions
- 0.1.2latestMar 26, 2026
- 0.1.1not indexedMay 21, 2026
- 0.1.0not indexedMay 21, 2026
github.com/treagod/marten-importmap
No description declared in shard.yml.
Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
marten_importmap:
github: treagod/marten-importmap
version: ~> 0.1.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
MartenImportmap
Integration between Marten and the ImportMap shard.
Installation
Add the shard to your shard.yml:
dependencies:
marten_importmap:
github: treagod/marten-importmap
Run shards install, then add the two requires to your project:
# src/project.cr
require "marten"
require "marten_importmap"
# src/cli.cr (needed before running `marten importmap init`)
require "marten/cli"
require "marten_importmap/cli"
Then initialize the project:
marten importmap init
marten importmap init will:
- add
require "marten_importmap"tosrc/project.crif not present - add
require "marten_importmap/cli"tosrc/cli.crif the file exists and the require is missing - add
MartenImportmap::Apptoconfig.installed_apps - create
config/initializers/importmap.crfor user-managed importmap entries - create
config/initializers/importmap_pins.crfor CLI-managed pins - create
src/assets/application.jsif it does not exist
Template tag
Add {% importmap %} inside the <head> of your base template. It renders the <script type="importmap"> block and a <script type="module"> tag for the entrypoint:
<head>
<link rel="stylesheet" href="{% asset 'css/app.css' %}" />
{% importmap %}
</head>
Optional arguments:
{% importmap %} {# default namespace, entrypoint "application" #}
{% importmap "admin" %} {# custom namespace #}
{% importmap "admin" entrypoint="admin/app" %} {# custom namespace and entrypoint #}
Configuration
Marten.configure do |config|
# Default: false (download resolved modules into vendor_scripts_dir)
config.importmap.keep_cdn_urls = false
# Default: "src/assets/vendor/"
config.importmap.vendor_scripts_dir = "src/assets/vendor/"
config.importmap.draw do
pin "application", "application.js"
end
end
Use config/initializers/importmap.cr for manual pins, namespaces, and pin_all_from directives.
CLI
After initialization, pin a library using JSPM:
marten importmap pin react
marten importmap pin react --from jsdelivr
Supported providers: jspm.io (default), jsdelivr, unpkg, skypack, esm.sh.
The command downloads the resolved module to src/assets/vendor/ and updates config/initializers/importmap_pins.cr:
# AUTO-GENERATED by `marten importmap pin ...`
# DO NOT EDIT.
Marten.configure do |config|
config.importmap.draw do
pin "react", "vendor/react.js"
end
end
config/initializers/importmap_pins.cr is CLI-managed. config/initializers/importmap.cr remains user-managed.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- May 21, 2026
- Commit
34cbf7486a1c- Indexed
- not yet
Dependents
Repository
github.com/treagod/marten-importmap
Metadata
- Created
- Aug 18, 2026
- Updated
- Sep 26, 2026
- Synced
- Sep 26, 2026
- Versions
- 3