Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snippets (pre-defined & user definable) #15

Open
ghetzel opened this issue Nov 28, 2021 · 0 comments
Open

Snippets (pre-defined & user definable) #15

ghetzel opened this issue Nov 28, 2021 · 0 comments
Assignees

Comments

@ghetzel
Copy link
Owner

ghetzel commented Nov 28, 2021

Feature: Snippets

A mechanism to load pre-defined chunks of text that can be inserted inline to streamline/standardize certain outputs.

<html>
<head>
  <meta charset="utf-8">

  {{ snippet "html-link" "/assets/css/app.js" }}
</head>
</html>

The above template would produce roughly the following output:

<html>
<head>
  <meta charset="utf-8">

  <link rel="stylesheet" href="/assets/css/app.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</head>
</html>

The {{ snippet }} template function would have following signature: snippet NAME [ARGS ..], with arguments being passed into the template, accessible with the param [N] function. In the above example, the SRI checksum would be dynamically calculated from the given argument. In this way, complex standardized blocks of functionality can be composed using snippets.

Configuration Sample

header:
  snippets:
    banner: '<h1 class="hero">Hello There!</h1>'
@ghetzel ghetzel self-assigned this Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant