metalsmith / metalsmith/js-bundle

Add jsbundle property to global metadata

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

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:

```njk
{% for script in jsbundle %}

{% endfor %}
```

As well as use a mechanism whereby file front-matter specifies the scripts to load:
```yaml
---
scripts:
- 'assets/js/common/source.js'
- 'assets/js/app/source.js':
async: true
integrity: 'abcdefg'
---
```
```njk
{% for script in jsbundle %}
{% if typeof script === 'string' %}

{% else %}

{% endfor %}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how global metadata and file front matter are currently assembled and passed to templates. Define the jsbundle shape for string and attribute-map entries, then verify that front-matter script declarations produce the expected script attributes in rendered templates.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.