{"id":2154,"date":"2026-08-01T10:00:00","date_gmt":"2026-08-01T10:00:00","guid":{"rendered":"https:\/\/muzi.tw\/thinking\/class-name-collision-tmp-en-us\/"},"modified":"2026-09-28T03:37:44","modified_gmt":"2026-09-28T03:37:44","slug":"class-name-collision","status":"publish","type":"post","link":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/","title":{"rendered":"The short class name is inside the long one"},"content":{"rendered":"<p class=\"mz-nt-lead\">We renamed a set of CSS classes, and the scope was clearly stated: only the ones starting with a particular prefix.<\/p>\n<p>Afterward, three components had lost their styles. None of them was on the rename list.<\/p>\n<h2>Why<\/h2>\n<p>The name we changed was the first part of three other names.<\/p>\n<p>Find-and-replace sees characters, not meaning. It has no idea that <code>.mz-card<\/code> and <code>.mz-card-meta<\/code> are two different things. To it, the second is just the first with a few more letters.<\/p>\n<h2>Why every check was green<\/h2>\n<p>Because the result <strong>was valid<\/strong>.<\/p>\n<p>The renamed stylesheet was syntactically correct. It parsed, loaded and applied. It just applied to something else, or to nothing.<\/p>\n<p>No compiler, linter or syntax check has an opinion about that. <strong>Only a human eye can catch it, and only if it already knows which page to look at.<\/strong><\/p>\n<h2>Two habits<\/h2>\n<p class=\"mz-nt-num\"><strong>\u2460 Always anchor the match.<\/strong> A class name has to be followed by a quote, a space or a curly brace, not by any character at all.<\/p>\n<p class=\"mz-nt-num\"><strong>\u2461 Do a dry run first.<\/strong> Print every match with its surrounding context, read through it, and only then write the change. It costs thirty seconds and saves you a visual bug you&#8217;d never trace back.<\/p>\n<h2>A lesson about naming<\/h2>\n<p>Design class names as namespaces and this kind of collision can&#8217;t happen.<\/p>\n<p class=\"mz-nt-key\">\u2b50 A utility name should either stand entirely on its own or end in a way that can&#8217;t be mistaken for a prefix. <strong>Looking hierarchical and being recognizable as a hierarchy by a machine are two different things.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.<\/p>\n","protected":false},"author":1,"featured_media":1016,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[29],"tags":[],"class_list":["post-2154","post","type-post","status-publish","format-standard","has-post-thumbnail","category-web-notes-en-us"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The short class name is inside the long one - Muzi Studio<\/title>\n<meta name=\"description\" content=\"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The short class name is inside the long one - Muzi Studio\" \/>\n<meta property=\"og:description\" content=\"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/\" \/>\n<meta property=\"og:site_name\" content=\"Muzi Studio\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-01T10:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-28T03:37:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"1004\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"headline\":\"The short class name is inside the long one\",\"datePublished\":\"2026-08-01T10:00:00+00:00\",\"dateModified\":\"2026-09-28T03:37:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/\"},\"wordCount\":264,\"publisher\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-class-collision-d7b5381e.jpg\",\"articleSection\":[\"Web &amp; Technology\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/\",\"name\":\"The short class name is inside the long one - Muzi Studio\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-class-collision-d7b5381e.jpg\",\"datePublished\":\"2026-08-01T10:00:00+00:00\",\"dateModified\":\"2026-09-28T03:37:44+00:00\",\"description\":\"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#primaryimage\",\"url\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-class-collision-d7b5381e.jpg\",\"contentUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-class-collision-d7b5381e.jpg\",\"width\":1800,\"height\":1004,\"caption\":\"A metal key and a similarly shaped black key\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/class-name-collision\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The short class name is inside the long one\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\",\"name\":\"Muzi Studio\",\"description\":\"Muzi Studio\",\"publisher\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/muzi.tw\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\",\"name\":\"Muzi Studio\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-logo-512.png\",\"contentUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-logo-512.png\",\"width\":512,\"height\":512,\"caption\":\"Muzi Studio\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"email\":\"hello@muzi.tw\",\"description\":\"A brand, web, and content studio in Taipei and Tokyo. We look at your business growth goals and current gaps before deciding if design is the answer.\",\"areaServed\":[\"Taiwan\",\"Japan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The short class name is inside the long one - Muzi Studio","description":"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/","og_locale":"en_US","og_type":"article","og_title":"The short class name is inside the long one - Muzi Studio","og_description":"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.","og_url":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/","og_site_name":"Muzi Studio","article_published_time":"2026-08-01T10:00:00+00:00","article_modified_time":"2026-09-28T03:37:44+00:00","og_image":[{"width":1800,"height":1004,"url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","type":"image\/jpeg"}],"author":"admin","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#article","isPartOf":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/"},"author":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"headline":"The short class name is inside the long one","datePublished":"2026-08-01T10:00:00+00:00","dateModified":"2026-09-28T03:37:44+00:00","mainEntityOfPage":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/"},"wordCount":264,"publisher":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"image":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#primaryimage"},"thumbnailUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","articleSection":["Web &amp; Technology"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/","url":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/","name":"The short class name is inside the long one - Muzi Studio","isPartOf":{"@id":"https:\/\/muzi.tw\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#primaryimage"},"image":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#primaryimage"},"thumbnailUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","datePublished":"2026-08-01T10:00:00+00:00","dateModified":"2026-09-28T03:37:44+00:00","description":"One global rename quietly stripped the styles from three components nobody had touched. Every automated check stayed green.","breadcrumb":{"@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#primaryimage","url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","contentUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","width":1800,"height":1004,"caption":"A metal key and a similarly shaped black key"},{"@type":"BreadcrumbList","@id":"https:\/\/muzi.tw\/en\/thinking\/class-name-collision\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/muzi.tw\/en\/"},{"@type":"ListItem","position":2,"name":"The short class name is inside the long one"}]},{"@type":"WebSite","@id":"https:\/\/muzi.tw\/en\/#website","url":"https:\/\/muzi.tw\/en\/","name":"Muzi Studio","description":"Muzi Studio","publisher":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/muzi.tw\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/muzi.tw\/en\/#organization","name":"Muzi Studio","url":"https:\/\/muzi.tw\/en\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/muzi.tw\/en\/#\/schema\/logo\/image\/","url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-logo-512.png","contentUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-logo-512.png","width":512,"height":512,"caption":"Muzi Studio"},"image":{"@id":"https:\/\/muzi.tw\/en\/#\/schema\/logo\/image\/"},"email":"hello@muzi.tw","description":"A brand, web, and content studio in Taipei and Tokyo. We look at your business growth goals and current gaps before deciding if design is the answer.","areaServed":["Taiwan","Japan"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-class-collision-d7b5381e.jpg","_links":{"self":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/comments?post=2154"}],"version-history":[{"count":2,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2154\/revisions"}],"predecessor-version":[{"id":2156,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2154\/revisions\/2156"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/media\/1016"}],"wp:attachment":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/media?parent=2154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/categories?post=2154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/tags?post=2154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}