Closed niklasgrewe closed 1 year ago
Can you provide how base.webc
is being used? Just trying to glean how you’re setting css
.
css
is a provided WebC helper from https://github.com/11ty/eleventy-plugin-bundle (and I agree this is confusing)
my base.webc
looks like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title @text="title"></title>
<style @raw="getBundle('css')" webc:keep></style>
</head>
<body @raw="content"></body>
</html>
Ah, then is your original comment mislabeled? I would like to know what css
is (or what you expect it to be) in this example:
<!-- layouts/base.webc -->
<link webc:if="css" webc:keep rel="stylesheet" :href="css">
<!-- will render to -->
<link rel="stylesheet" href="function (...args) {
benchmark.before();
let ret = callback.call(this, ...args);
benchmark.after();
return ret;
}">
sorry i forgot something... my base.webc
looks like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title @text="title"></title>
<link webc:keep rel="stylesheet" :href="`assets/css/${this.css}`" />
<style @raw="getBundle('css')" webc:keep></style>
</head>
<body @raw="content"></body>
</html>
and inside my home.webc
i set the css
inside my frontmatter like this:
---
layout: layouts/base.webc
css: home.css
---
but this:
<link webc:keep rel="stylesheet" :href="`assets/css/${this.css}`" />
will render to:
<link rel="stylesheet" href="function (...args) {
benchmark.before();
let ret = callback.call(this, ...args);
benchmark.after();
return ret;
}">
Perfect, that’s what I needed, thank you.
Dynamic variables are not resolved when using
webc:keep
This works ✅
But this doesn't work 🚫