Most "design inspector" extensions ask for a permission set that makes no sense for what they do: <all_urls>, background network access, sometimes even tabs with full history read. I wanted the opposite constraint for SpecPeek: a CSS, Tailwind, and SVG inspector that runs on exactly the tab you click, ships zero third-party JS, and never has a reason to see a URL you didn't explicitly show it. This post is about the engineering decisions that came out of holding that line — manifest permissions, Shadow DOM isolation, and writing a Tailwind class converter and a ZIP exporter from scratch instead of pulling in dependencies.
Why activeTab instead of <all_urls>
The default instinct for a page-inspection tool is to request host permissions for everything, because then your content script is always available and you never have to think about injection timing. That convenience comes at a real cost to the user: a dormant extension with <all_urls> can read and script every page they visit, forever, whether or not they're using it that day.
Manifest V3's activeTab permission flips that trade. The extension has zero access until the user explicitly invokes it (a toolbar click, in our case) on the page they're currently looking at. At that point, chrome.scripting.executeScript injects the content script into that one tab for that one session. Close the tab, lose the grant. Never click the icon on a page, and SpecPeek has literally never run there.
The practical cost is that you give up "always-on" conveniences — no persistent badge counts, no background re-scan on navigation. For an inspector tool that's invoked deliberately, that's not a real loss. The combination we ended up with is small on purpose:
-
activeTab— script the current tab only when clicked -
scripting— the actual injection APIactiveTabpairs with in MV3 -
storage— cache a license key and a few UI preferences locally
No tabs, no webNavigation, no <all_urls>, no remote config endpoint. The manifest is the kind of thing you can paste into a store listing and have it match the code, because there's nothing hiding behind a broader grant than the feature set needs.
Shadow DOM: the inspector can't be allowed to see the page's CSS, or vice versa
Once you're injecting a floating panel UI into an arbitrary page, you have two independent leakage problems:
- The host page's global CSS (resets,
* { box-sizing: ... }, aggressivea { color: ... }rules, utility frameworks) cascades into your injected markup and makes your panel look like whatever site you're standing on. - Your panel's own styles can leak outward and visibly break the page you're inspecting — which is an unacceptable failure mode for a tool whose entire pitch is "look, don't touch."
A shadow root attached to a single injected host element solves both directions at once. CSS written inside the shadow tree doesn't cascade out, and (critically) the page's own stylesheets don't cascade in — shadow DOM is a genuine style boundary, not just a DOM one. We attach in closed mode so page scripts can't reach into the panel's shadow tree and start poking at inspector internals, which also closes off a class of fingerprinting/interference vectors from hostile pages.
There's one thing shadow DOM doesn't give you for free: a few CSS properties are defined as inherited all the way down through shadow boundaries regardless (font-family, color, font-size if unset). If a page sets html { font-family: "SomeWeirdFont" } and you don't explicitly reset it inside the shadow root, your panel silently inherits it. The fix is boring but necessary — an explicit reset block at the shadow root's own :host and a wildcard selector pinning font-family, line-height, and color back to known values before any component styles apply.
Writing the Tailwind converter without a DOM
A chunk of SpecPeek Pro is a computed-style-to-Tailwind-utility converter: hover an element, get back flex items-center gap-2 px-[18px] rounded-lg instead of raw CSS. The temptation is to reach for PostCSS or an existing Tailwind tokenizer package. We didn't, for two reasons: it's extra weight in a content script that already has to stay small to inject fast, and it's extra surface area in a supply chain we're trying to keep auditable end to end.
The actual algorithm is simpler than it sounds once you accept that "best-effort, honest about gaps" beats "clever, sometimes wrong." Every property handler returns either:
- an exact scale match (
padding: 16px→p-4, because 16px is on Tailwind's default spacing scale), or - an arbitrary-value fallback (
padding: 18px→p-[18px], because 18 isn't on the scale and guessing the "closest" one would silently misrepresent the source CSS), or - nothing, if the property isn't one we've mapped at all (
transition,cursor,transformland here and get surfaced as "unsupported" instead of dropped silently)
That third bucket matters more than it looks. A tool that pretends to convert everything and quietly drops what it can't handle will eventually cost someone a layout bug they can't find, because the diff between their CSS and their Tailwind output is invisible. Surfacing "3 properties weren't converted, here they are" is slower to look at but it's the only version of this feature that's safe to trust.
Because every handler is a pure function — string value in, class name out, no DOM, no window — the whole converter is unit-testable in plain Node with zero mocking. We shipped a free, standalone version of exactly this engine as a CSS to Tailwind converter web tool, and having it testable outside a browser context is what made it possible to verify dozens of real-world CSS snippets against expected output before it ever touched the extension's UI.
Exporting SVGs/images without a ZIP library
The other zero-dependency decision was the batch asset export feature: collect every SVG and raster image SpecPeek can see on the page and hand the user a single ZIP. The ZIP format is simple enough that a from-scratch implementation is maybe 150 lines: local file headers, a central directory, CRC32 computed by hand with the standard polynomial table, everything UTF-8 encoded for filenames so non-ASCII asset names round-trip correctly. Images that fail CORS (cross-origin canvases that refuse toBlob) get written into a small manifest text file inside the ZIP instead of silently vanishing from the export — again, the "don't lie about what happened" rule from the Tailwind converter applies here too.
We applied the same "ship the deterministic core as a standalone free tool" approach to the SVG side: an SVG cleaner and React JSX / CSS data-URI converter that strips comments, <metadata>, Illustrator/Inkscape namespace cruft, and — because pasted SVG from an untrusted source is a real self-XSS vector — any <script> tag or inline on* handler, before anything gets rendered as a live preview.
What this adds up to
None of these are individually exotic techniques. activeTab over <all_urls>, shadow DOM for style isolation, hand-rolled deterministic converters over a dependency — each one is a known pattern. What's uncommon is holding all three at once under time pressure, because each one is the slower path relative to its alternative. It would have been faster to ship with broad host permissions, a light-DOM injected panel, and a Tailwind tokenizer pulled from npm. The slower path is the one where the manifest, the store listing, and the actual runtime behavior all say the same thing, and where you can hand someone the converter's test suite instead of asking them to trust a demo GIF.
If you want to try the full inspector — box model, Tailwind v3/v4 output, page-wide color palettes, WCAG 2.1 contrast, and batch SVG/image ZIP export — it's live on Microsoft Edge Add-ons (free core forever, optional one-time Pro) and documented at specpeek.kintolabs.com. You can also use both standalone converters with zero install and zero uploads at kintolabs.com/tools/.
