11ty / 11ty/eleventy-plugin-bundle

Needs additional guidance around feeding `getBundle` through a minifier

Open
#7 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug education has-workaround
Dominant language
JavaScript
Stars
83
Forks
8
PR merge metrics
No merged PRs in 30d

Description

If you run getBundle output through a minifier before the transform gets to it, it will get removed!

Specifically this quick tip: https://www.11ty.dev/docs/quicktips/inline-css/#capture-and-minify

<!-- capture the CSS content as a Nunjucks variable -->
{% set css %}
  {% include "sample.css" %}
  {% getBundle "css" %}
{% endset %}
<!-- feed it through our cssmin filter to minify -->
<style>
  {{ css | cssmin | safe }}
</style>

Workaround is to move the bundle outside of the css minification pipeline (and optionally use a bundle transform to minify instead):

<!-- capture the CSS content as a Nunjucks variable -->
{% set css %}
  {% include "sample.css" %}
{% endset %}
<!-- feed it through our cssmin filter to minify -->
<style>
  {{ css | cssmin | safe }}
</style>
<style>{% getBundle "css" %}</style>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the linked inline CSS quick tip and review how it documents feeding getBundle output through cssmin. Update the guidance to explain that the bundle can be removed by the minifier and show the workaround or bundle-transform option; done when the example clearly avoids that failure mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.