Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Features
Multiple Entrypoints
Support multiple entrypoints in a Hanami application.
This feature is meant to split the js/css bundles in a way that makes sense for the user application.
Example: If the user wants a login page that doesn't have all the other js/css bundles, they can create an
app/assets/javascripts/login/app.js
, and Hanami::Assets will bundle it separately aspublic/assets/login/app-abc123.js
.Stylesheet importing
Import stylesheets by using the
@import
directive.Example: From
app.css
, a user can importreset.css
like this:@import 'reset.css'
.Import images from stylesheets
If an image is referenced from a stylesheet, it will be bundled in the destination directory.
Example:
Given a background image, located at
app/assets/images/background.jpg
, and a stylesheet like the followingapp/assets/stylesheets/app.css
.Hanami::Assets will bundle the image at:
public/assets/background-UU2XY655.jpg
and rewrite the background image path of the destination CSS (public/assets/app-X3IVBUS4.css
):The image will be part of the Assets Manifest, and Hanami::Assets will calculate the Subresource Integrity (if enabled).
Implementation
The app will recursively search for
app.{js,ts,mjs,mts,tsx,jsx}
inapp/assets/javascripts
andslices/*/assets/javascripts
.The matched files will constitute esbuild entrypoints.