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:
- Javascript
- Images
- 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!
The current version of v0.34.0 is a fully functional import map
generating and asset manager.
It provides the following:
- Specify your dev folder for your javascript
- Specify your output folder where your assets are served
- Simple, Crystal methods for adding assets from the local folder or a CDN to your import map
- It also fully supports scopes (which the
importmap-rails
gem does not support). - It supports multiple import maps, in case you want entirely separate mappings in different areas of your application
- 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.