generated from metalsmith/core-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Adding jsbundle property to the global metadata with a structure jsbundle: { 'source-file.js': { src: 'destination-file.js', async: }}}.
This allows templates to do:
{% for script in jsbundle %}
<script {% for attr,value in script %} {{attr}}="{{value}}"{% endfor %}></script>
{% endfor %}As well as use a mechanism whereby file front-matter specifies the scripts to load:
---
scripts:
- 'assets/js/common/source.js'
- 'assets/js/app/source.js':
async: true
integrity: 'abcdefg'
---{% for script in jsbundle %}
{% if typeof script === 'string' %}
<script src="{{ script }}"></script>
{% else %}
<script {% for attr,value in script %} {{attr}}="{{value}}"{% endfor %}></script>
{% endfor %}Metadata
Metadata
Assignees
Labels
No labels