You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the spear's concept is Component oriented. So we had better to support scoped style and script.
Now, spear treat the component's style as global.
The first element is scoped style element. It's simple CSS. A second is Component element.
Astro generated the scoped style for injecting class name when building.
What is this?
One of the spear's concept is Component oriented. So we had better to support scoped style and script.
Now, spear treat the component's style as global.
sample-component.spear
test.html
Generated result is the bellow:
Almost site might have no problem, but this global scoped style will cause bugs.
How do we implement this feature?
Scoped Style is discussed with WHATWG as well:
whatwg/html#552
<style scoped>
is deprecated already. So we might inject the scoped class name or use the Shadow DOM or insert the style as inline to each element.これは何?
Spear のコンセプトの1つはコンポーネント指向です。そこでスコープスタイルや、スコープスクリプトを導入すべきだと思います。現在、spear はコンポーネントのスタイルをグローバルとして扱います。
sample-component.spear
test.html
生成された結果は次の通りです。
ほとんどのサイトでは問題ないと思いますが、グローバルスコープだとバグが発生する可能性があります。
どうやって実装するか?
スコープ限定のスタイルは WHATWG でも議論されていました。
whatwg/html#552
<style scoped>
は既に非推奨となっています。なので、スコープ限定のクラス名を注入するか、シャドーDOMを使うか、各要素ごとにインラインスタイルを追加する必要があります。The text was updated successfully, but these errors were encountered: