You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Nicolas Peltier <np...@apache.org> on 2020/09/07 08:22:45 UTC
[htl][proposal] extending HTL scripting logic to style tag and attribute
Hi,
certain components require that we overcome beautiful concept of separation
of concern between CSS & HTML as variability of the potential styling is
too high.
This makes us developer forced to add style tag or attribute, together with
inner htl scripting logic, that has been designed to template HTML, but is
a bit too loud for CSS rules.
My proposal is that we extend HTL only for that purpose to parse CSS files
that could be included in style tag or attributes, with similar loop & if
logic, maybe in a different syntax to keep the CSS valid, so to have
something like [0]. Please consider proposed syntax as symbolic, we can
discuss that later if there is an agreement on the proposal itself.
We could also have existing css compilers like less or sass but that might
be overkill and this would lead to lot of frustration as we wouldn't
implement everything.
Wdyt?
Nicolas
[0]
OLD (not counting the CSS in the models):
<style>
<sly data-sly-repeat.item="${model.definitions}">
${'#{0}' @ format=model.id, context='styleString'} > .items {
<sly data-sly-test.output="${item.show}">
${definition.width}
${definition.minHeight}
${definition.order}
</sly>
}
<sly>
</style>
NEW:
<style data-sly-include="style.css"/>
and
style.css:
# sly-repeat.item="${model.definitions}"
#'$model-id' > .items {
# sly-test.output="${item.show}
width: $item-width;
min-height: $item-minHeight;
order: $item-order
# /sly
}
# /sly
Re: [htl][proposal] extending HTL scripting logic to style tag and attribute
Posted by Nicolas Peltier <np...@apache.org>.
Ok, https://github.com/adobe/htl-spec/issues/89
Yeah, as insinuated in my original mail, I would only parse CSS referenced
in style tag / attributes from HTL scripts. Other ones should be left to
dedicated tools
Le mar. 8 sept. 2020 à 17:05, Radu Cotescu <ra...@apache.org> a écrit :
> Hello Nicolas,
>
> I think this is a discussion for the HTL specification group (I’m now
> wearing only my Sling committer hat).
>
> What I can tell you, though, is that the way you want the feature to work
> implies that style.css will be a file interpreted server-side by a script
> engine. I’m not sure if we want ALL css files to be executed by such a
> script engine.
>
> Regards,
> Radu
Re: [htl][proposal] extending HTL scripting logic to style tag and
attribute
Posted by Radu Cotescu <ra...@apache.org>.
Hello Nicolas,
I think this is a discussion for the HTL specification group (I’m now wearing only my Sling committer hat).
What I can tell you, though, is that the way you want the feature to work implies that style.css will be a file interpreted server-side by a script engine. I’m not sure if we want ALL css files to be executed by such a script engine.
Regards,
Radu