11ty / eleventy-plugin-webc

Adds support for WebC *.webc files to Eleventy
https://www.11ty.dev/docs/languages/webc/
119 stars 10 forks source link

Persist page-specific bundles to the file system to make use of browser cache #4

Closed zachleat closed 1 year ago

zachleat commented 1 year ago

https://github.com/11ty/eleventy-plugin-webc#css-and-js-bundler-mode but I want the deferred bucket to write to the file system (and the layout file reference the file’s URL) to make use of the browser cache.

Requested by https://twitter.com/techytacos/status/1575143767484481537 and https://twitter.com/the_ross_man/status/1574864528268992514

zachleat commented 1 year ago

https://github.com/11ty/eleventy-plugin-bundle#write-a-bundle-to-a-file has this!

Related #48

douglas-johnson commented 1 year ago

I would like to use this feature, but I think I must be misunderstanding something. What am I doing wrong here?

I have this is my layout.webc file: <link rel="stylesheet" type="text/css" :href="getBundleFileUrl('css')" webc:keep />

But I don't get a CSS file in my _site folder or any value for href. The output is: <link rel="stylesheet" type="text/css" href="">

My related depedencies are:

{
"@11ty/eleventy": "^2.0.0",
"@11ty/eleventy-plugin-webc": "^0.8.1",
"@11ty/eleventy-fetch": "^3.0.0",
"@11ty/eleventy-plugin-bundle": "^1.0.1"
}
zachleat commented 1 year ago

Ah, sorry @douglas-johnson—this requires WebC v0.9.0 which will ship today.