Skip to content

Commit

Permalink
WebC example
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 2, 2023
1 parent 1296c65 commit 4fd46c3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,24 @@ Now the compiled Sass is available in your default bundle and will show up in `g

#### Use with [WebC](https://www.11ty.dev/docs/languages/webc/)

_TODO Coming soon_
Starting with `@11ty/eleventy-plugin-webc@0.9.0` this plugin is used by default in the Eleventy WebC plugin. Specifically, [WebC Bundler Mode](https://www.11ty.dev/docs/languages/webc/#css-and-js-(bundler-mode)) now uses the bundle plugin under the hood.

To add CSS to a page bundle in WebC, you would use a `<style>` element in a WebC page or component:

```html
<style>/* This is bundled. */</style>
<style webc:keep>/* Do not bundle me—leave as is */</style>
```

To add JS to a page bundle in WebC, you would use a `<script>` element in a WebC page or component:

```html
<script>/* This is bundled. */</script>
<script webc:keep>/* Do not bundle me—leave as is */</script>
```

* Existing calls via WebC helpers `getCss` or `getJs` (e.g. `<style @raw="getCss(page.url)">`) have been wired up to this plugin behind the scenes.
* Outside of WebC, the [Universal Filters `webcGetCss` and `webcGetJs`](https://www.11ty.dev/docs/languages/webc/#css-and-js-(bundler-mode)) were available to access CSS and JS bundles but are considered deprecated in favor of new bundle plugin Universal Shortcodes `getBundle("css")` and `getBundle("js")` respectively.

#### Bundling on the [Edge](https://www.11ty.dev/docs/plugins/edge/)

Expand Down Expand Up @@ -264,7 +281,6 @@ Must haves:
* Add postprocessing hooks for postcss modifications
* guarantee that the transform runs first in order somehow (think about transform order)
* TODOs on readme: WebC example
* JavaScript API independent of eleventy
Version Two:
Expand Down

0 comments on commit 4fd46c3

Please sign in to comment.