mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-06 01:40:19 +00:00
feat(design): declare the design layer first, make Bootstrap opt-in
The injector knows a third snippet kind, top, and places it right after the opening head tag. The design role uses it to link layer.css, which only declares the cascade layer infinito-design. Declared before the stylesheets of the app, that layer loses to every rule of the app, layered or not. The shared Bootstrap component mapping is linked only for a role whose design entry sets bootstrap: true. A role stylesheet or design script that renders empty counts as absent, and a deploy removes the stylesheet a role no longer ships from the CDN. The two style.css guides describe the layer, the order of in-house options before the role stylesheet, and the frame and focus tokens. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
caaedecafa
commit
681699a2c5
11 files changed
+67
-20
No files matched your search
@@ -49,20 +49,26 @@ class TestInjSnippets(unittest.TestCase):
|
||||
|
||||
cls.mod = module
|
||||
|
||||
cls.feature_top_only = "zz_toponly"
|
||||
cls.feature_head_only = "zz_headonly"
|
||||
cls.feature_body_only = "zz_bodyonly"
|
||||
cls.feature_both = "zz_both"
|
||||
cls.feature_missing = "zz_missing"
|
||||
|
||||
cls._mkrole(cls.feature_top_only, top=True)
|
||||
cls._mkrole(cls.feature_head_only, head=True, body=False)
|
||||
cls._mkrole(cls.feature_body_only, head=False, body=True)
|
||||
cls._mkrole(cls.feature_both, head=True, body=True)
|
||||
|
||||
@classmethod
|
||||
def _mkrole(cls, feature, head=False, body=False):
|
||||
def _mkrole(cls, feature, head=False, body=False, top=False):
|
||||
role_dir = str(Path(cls.roles_dir) / f"sys-front-inj-{feature}")
|
||||
tmpl_dir = str(Path(role_dir) / "templates")
|
||||
Path(tmpl_dir).mkdir(parents=True, exist_ok=True)
|
||||
if top:
|
||||
(Path(tmpl_dir) / "top_sub.j2").write_text(
|
||||
"<!-- top test -->\n", encoding="utf-8"
|
||||
)
|
||||
if head:
|
||||
with Path(str(Path(tmpl_dir) / "head_sub.j2")).open(
|
||||
"w", encoding="utf-8"
|
||||
@@ -78,6 +84,15 @@ class TestInjSnippets(unittest.TestCase):
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def test_top_features_filter(self):
|
||||
features = [self.feature_top_only, self.feature_head_only, self.feature_both]
|
||||
result = self.mod.inj_features_filter(features, kind="top")
|
||||
self.assertEqual(result, [self.feature_top_only])
|
||||
|
||||
def test_unknown_kind_is_rejected(self):
|
||||
with self.assertRaises(ValueError):
|
||||
self.mod.inj_features_filter([self.feature_both], kind="footer")
|
||||
|
||||
def test_head_features_filter(self):
|
||||
features = [self.feature_head_only, self.feature_both, self.feature_body_only]
|
||||
result = self.mod.inj_features_filter(features, kind="head")
|
||||
|
||||
Reference in new issue
Block a user