Skip to content
Honmaple
Documentation navigation

assets

On this page

Assets

Compile SCSS, combine and minify resources, and resize images.

hooks:
  assets:
    enabled: true
    option:
      css:
        files:
          - "scss/style.scss"
          - "css/custom.css"
        sass_compiler: "dartsass"
        filters:
          - "cssmin"
        output: "static/style.min.css"
      js:
        files:
          - "js/main.js"
          - "js/theme.js"
        filters:
          - "jsmin"
        output: "static/script.min.js"
      cover:
        files:
          - "images/cover.jpg"
        filters:
          - name: "image"
            width: 1200
            height: 800
            fit: "inside"
            quality: 82
        output: "static/cover.jpg"
Option Description
files Required source files; supports glob patterns
sass_compiler libscss or dartsass; applies only to .scss and .sass files
filters String entries or objects: cssmin, jsmin, or image
output Required output path

SCSS and Sass files are compiled automatically using libscss by default. To use Dart Sass Embedded, set sass_compiler: "dartsass" and install a sass executable on PATH that supports sass --embedded.

cssmin and jsmin process combined text resources and accept no parameters.

image processes one image. It accepts width, height, fit, and quality. Fit modes are inside (default), cover, and fill. JPEG quality ranges from 1 to 100 and defaults to 85. The output extension selects the format: .jpg, .jpeg, .png, or .gif. GIF output is static; animation is not preserved.

With image, the file patterns must match exactly one image. No text concatenation takes place. Inline template tags support string filters only; configure parameterized image processing in the configuration file.

Missing files or output, unknown filters, and invalid filter options cause initialization to fail.

Template usage:

{% assets css %}
<link rel="stylesheet" href="{{ config.base_url }}/{{ asset_url }}">
{% endassets %}