11ty / 11ty/webc

Compiling individual instances instead of whole page

Open
#27 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
46
Avg merge
10m
Merged PRs (30d)
2

Description

The page.compile() API seems like it's designed specifically to be used with a page that itself is written in the webc format. This means that any existing (unrelated) scripts and style tags on the page need to have webc:keep added to them to prevent webc from touching them.

It would be nice to be able to tell webc to only compile the files that it finds in the globs passed via defineComponents and ignore the rest of the page. Since webc knows about this list of components ahead of time, this should be possible. 🤔

One very common use case for this is when a global layout file is written in plain html/njk. This might have critical styles and inline scripts that should not be processed by webc.

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 with the page.compile() API and the component list passed through defineComponents; inspect how webc:keep currently protects unrelated scripts and styles. Done means pages with plain HTML/Nunjucks layouts compile only matching component files while preserving unrelated scripts, styles, and other markup without requiring webc:keep.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.