Skip to content

Commit 137cf63

Browse files
authored
fix #538: plugin for CT scan of <head> (#543)
1 parent c22eda6 commit 137cf63

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

app/plugins/_registry.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { commands as barrel_roll_commands, description as barrel_roll_descriptio
33
import { commands as pesticide_commands, description as pesticide_description, default as PesticidePlugin } from './pesticide'
44
import { commands as construct_commands, description as construct_description, default as ConstructPlugin } from './construct'
55
import { commands as construct_debug_commands, description as construct_debug_description, default as ConstructDebugPlugin } from './construct.debug'
6+
import { commands as ct_head_scan_commands, description as ct_head_scan_description, default as CtHeadScanPlugin } from './ct-head-scan'
67
import { commands as wireframe_commands, description as wireframe_description, default as WireframePlugin } from './wireframe'
78
import { commands as skeleton_commands, description as skeleton_description, default as SkeletonPlugin } from './skeleton'
89
import { commands as tag_debugger_commands, description as tag_debugger_description, default as TagDebuggerPlugin } from './tag-debugger'
@@ -27,6 +28,7 @@ export const PluginRegistry = new Map(Object.entries({
2728
...commandsToHash(pesticide_commands, PesticidePlugin),
2829
...commandsToHash(construct_commands, ConstructPlugin),
2930
...commandsToHash(construct_debug_commands, ConstructDebugPlugin),
31+
...commandsToHash(ct_head_scan_commands, CtHeadScanPlugin),
3032
...commandsToHash(wireframe_commands, WireframePlugin),
3133
...commandsToHash(skeleton_commands, SkeletonPlugin),
3234
...commandsToHash(tag_debugger_commands, TagDebuggerPlugin),
@@ -47,6 +49,7 @@ export const PluginHints = [
4749
{command: pesticide_commands[0], description: pesticide_description},
4850
{command: construct_commands[0], description: construct_description},
4951
{command: construct_debug_commands[0], description: construct_debug_description},
52+
{command: ct_head_scan_commands[0], description: ct_head_scan_description},
5053
{command: wireframe_commands[0], description: wireframe_description},
5154
{command: skeleton_commands[0], description: skeleton_description},
5255
{command: tag_debugger_commands[0], description: tag_debugger_description},

app/plugins/ct-head-scan.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const commands = [
2+
'head scan',
3+
]
4+
5+
export const description = `diagnose potential performance issues in your page's tags`
6+
7+
export default function () {
8+
const ct = document.createElement("link");
9+
ct.rel = "stylesheet";
10+
ct.href = "https://csswizardry.com/ct/ct.css";
11+
ct.classList.add("ct");
12+
document.head.appendChild(ct);
13+
}

0 commit comments

Comments
 (0)