New AssetPipeline shard for generating Import Maps

Over the last couple of years, no-build JS has come back into popularity because of newer web standards that allow for un-bundled/transpiled Javascript.

The world of bundling javascript ultimately handles 3 major aspects of front-end development:

  1. Javascript
  2. Images
  3. Styling (SCSS & CSS)

To begin bringing Crystal web frameworks into a more modern front-end “no-build” process, I’ve begun developing the “asset_pipeline” shard.

You can review the documentation more easily here: AssetPipeline::FrontLoader - asset_pipeline v0.34.0

This shard is framework independent, so please feel free to use it in your projects as you see fit! :slight_smile:

The current version of v0.34.0 is a fully functional import map generating and asset manager.

It provides the following:

  1. Specify your dev folder for your javascript
  2. Specify your output folder where your assets are served
  3. Simple, Crystal methods for adding assets from the local folder or a CDN to your import map
  4. It also fully supports scopes (which the importmap-rails gem does not support).
  5. It supports multiple import maps, in case you want entirely separate mappings in different areas of your application
  6. For local files, it creates a fingerprint of the file & adds this fingerprint to the file name when output for use. This means it’s easy to work around file changes and browser caching and done for you.

As I add and build the other features for images and styling, I’ll increment the releases as follows:

v0.67.0 - will be for when images are supported
v1.0.0 - will be for when all 3 aspects of a complete “asset pipeline” are finished and in production working order.

8 Likes