{"id":183876,"date":"2023-11-04T00:43:39","date_gmt":"2023-11-04T00:43:39","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/pattern-css\/"},"modified":"2026-03-24T17:26:12","modified_gmt":"2026-03-24T17:26:12","slug":"pattern-css","status":"publish","type":"plugin","link":"https:\/\/twd.wordpress.org\/plugins\/pattern-css\/","author":9133186,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.5.5","stable_tag":"1.5.5","tested":"7.0","requires":"6.7","requires_php":"7.0","requires_plugins":null,"header_name":"Pattern CSS","header_author":"Kevin Batdorf","header_description":"Lightening Fast, Safe, In-editor CSS Optimization and Minification Tool","assets_banners_color":"","last_updated":"2026-03-24 17:26:12","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/twitter.com\/kevinbatdorf","rating":5,"author_block_rating":4.8392857142857,"active_installs":100,"downloads":4336,"num_ratings":8,"support_threads":2,"support_threads_resolved":1,"author_block_count":8,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"kbat82","date":"2023-11-04 00:58:17"},"1.0.1":{"tag":"1.0.1","author":"kbat82","date":"2023-11-18 14:27:39"},"1.1.0":{"tag":"1.1.0","author":"kbat82","date":"2024-02-19 09:05:32"},"1.2.0":{"tag":"1.2.0","author":"kbat82","date":"2024-02-20 16:48:53"},"1.2.1":{"tag":"1.2.1","author":"kbat82","date":"2024-03-13 17:45:56"},"1.2.2":{"tag":"1.2.2","author":"kbat82","date":"2024-04-19 15:43:36"},"1.2.3":{"tag":"1.2.3","author":"kbat82","date":"2024-06-06 19:47:05"},"1.2.4":{"tag":"1.2.4","author":"kbat82","date":"2024-07-21 19:00:52"},"1.2.5":{"tag":"1.2.5","author":"kbat82","date":"2024-07-28 16:39:56"},"1.2.6":{"tag":"1.2.6","author":"kbat82","date":"2024-12-13 01:31:46"},"1.3.0":{"tag":"1.3.0","author":"kbat82","date":"2025-03-06 08:38:54"},"1.4.0":{"tag":"1.4.0","author":"kbat82","date":"2025-05-12 13:25:48"},"1.5.0":{"tag":"1.5.0","author":"kbat82","date":"2025-05-18 10:12:14"},"1.5.1":{"tag":"1.5.1","author":"kbat82","date":"2025-05-18 12:44:43"},"1.5.2":{"tag":"1.5.2","author":"kbat82","date":"2025-05-28 15:08:41"},"1.5.3":{"tag":"1.5.3","author":"kbat82","date":"2025-09-27 13:09:17"},"1.5.4":{"tag":"1.5.4","author":"kbat82","date":"2026-03-22 19:42:00"},"1.5.5":{"tag":"1.5.5","author":"kbat82","date":"2026-03-24 17:26:12"}},"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":8},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3295259,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3295259,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1","1.1.0","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4","1.2.5","1.2.6","1.3.0","1.4.0","1.5.0","1.5.1","1.5.2","1.5.3","1.5.4","1.5.5"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3295651,"resolution":"1","location":"assets","locale":""},"screenshot-2.gif":{"filename":"screenshot-2.gif","revision":3295651,"resolution":"2","location":"assets","locale":""},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3295651,"resolution":"3","location":"assets","locale":""},"screenshot-4.png":{"filename":"screenshot-4.png","revision":3295651,"resolution":"4","location":"assets","locale":""}},"screenshots":{"1":"Add styles not available in the editor (supoprts nesting)","2":"Add animation using the global editor","3":"Will warn you if your CSS is invalid","4":"Works with reusable and synced patterns"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1220,356,1332,3936,2003],"plugin_category":[59],"plugin_contributors":[149290],"plugin_business_model":[],"class_list":["post-183876","plugin","type-plugin","status-publish","hentry","plugin_tags-block","plugin_tags-css","plugin_tags-editor","plugin_tags-inline","plugin_tags-styles","plugin_category-utilities-and-tools","plugin_contributors-kbat82","plugin_committers-kbat82"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/pattern-css\/assets\/icon-128x128.png?rev=3295259","icon_2x":"https:\/\/ps.w.org\/pattern-css\/assets\/icon-256x256.png?rev=3295259","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/pattern-css\/assets\/screenshot-1.png?rev=3295651","caption":"Add styles not available in the editor (supoprts nesting)"},{"src":"https:\/\/ps.w.org\/pattern-css\/assets\/screenshot-2.gif?rev=3295651","caption":"Add animation using the global editor"},{"src":"https:\/\/ps.w.org\/pattern-css\/assets\/screenshot-3.png?rev=3295651","caption":"Will warn you if your CSS is invalid"},{"src":"https:\/\/ps.w.org\/pattern-css\/assets\/screenshot-4.png?rev=3295651","caption":"Works with reusable and synced patterns"}],"raw_content":"<!--section=description-->\n<p>The missing inline block CSS editor for the Gutenberg editor. Very powerful with synced patterns as well. And it pairs well with global styles.<\/p>\n\n<p>This plugin is perfect for users looking to add CSS for blocks without needing to create a child theme, or use a bloated plugin. Client safe too. CSS won't leak outside of the block, and only valid block CSS is persisted.<\/p>\n\n<p>Star it on <a href=\"https:\/\/github.com\/KevinBatdorf\/pattern-css\">GitHub<\/a>\nFollow me on Twitter <a href=\"https:\/\/twitter.com\/kevinbatdorf\">@kevinbatdorf<\/a><\/p>\n\n<h4>How to<\/h4>\n\n<ul>\n<li>Every block will have a new \"Pattern CSS\" settings panel<\/li>\n<li>Open it and add any CSS. It will be scoped to the block<\/li>\n<li>To target the block directly, you must use the <code>[block]<\/code> selector<\/li>\n<li>To target any element <em>inside<\/em> the block, use the normal CSS selector<\/li>\n<li>Use <code>!important<\/code> to override your theme styles (use sparingly)<\/li>\n<\/ul>\n\n<h4>Global Editor<\/h4>\n\n<ul>\n<li>Access global styles under the options menu (three dots) in the top right corner of the editor<\/li>\n<li>Additionaly, you can open from the Pattern CSS block editor controls<\/li>\n<\/ul>\n\n<h4>Features<\/h4>\n\n<ul>\n<li>Powered by WebAssembly for fast and secure CSS parsing<\/li>\n<li>Smart loading. Only loads the CSS when the block is present<\/li>\n<li>Styles persist when changing themes<\/li>\n<li>Scopes styles to the block so that parent\/sibling blocks are not affected<\/li>\n<li>It's fast<\/li>\n<li>CSS is minified and optimized<\/li>\n<li>It's safe. Invalid, non-spec CSS is never persisted<\/li>\n<li>Supports reusable (synced or not-synced) patterns<\/li>\n<li>See changes on the page as you make them<\/li>\n<li>Combines adjacent rules (to decrease size)<\/li>\n<li>Minifies colors and math functions to simplify according to spec<\/li>\n<li>Supports CSS nesting<\/li>\n<\/ul>\n\n<h4>Basic Example<\/h4>\n\n<pre><code>\/* Target the block directly *\/\n[block] {\n  background: antiquewhite;\n  padding: 2rem;\n}\n\/* Target any inner elements *\/\na {\n  text-decoration-color: burlywood;\n  text-decoration-thickness: 2px;\n  text-decoration-style: solid !important;\n}\na:hover {\n  text-decoration-color: darkgoldenrod;\n}\n\n\/* Output: *\/\n.pcss-a1b7b016{background:#faebd7;padding:2rem}.pcss-a1b7b016 a{text-decoration-color:#deb887;text-decoration-thickness:2px;text-decoration-style:solid!important}.pcss-a1b7b016 a:hover{text-decoration-color:#b8860b}\n<\/code><\/pre>\n\n<h4>Supports Media Queries<\/h4>\n\n<pre><code>@media (prefers-color-scheme: dark) {\n  [block] {\n    border-color: blue;\n  }\n}\n\n\/* Output: *\/\n@media (prefers-color-scheme:dark){.pcss-cddaa023{border-color:#00f}}\n<\/code><\/pre>\n\n<h4>Combines Rules<\/h4>\n\n<pre><code>[block] {\n  color: red;\n}\n.bar {\n  color: red;\n}\n\n\/* Output: *\/\n.pcss-3aa0f0fc,.pcss-3aa0f0fc .bar{color:red}\n<\/code><\/pre>\n\n<h4>Fixes redundant properties<\/h4>\n\n<pre><code>[block] {\n  padding-top: 5px;\n  padding-left: 50px;\n  padding-bottom: 15px;\n  padding-right: 5px;\n}\n\n\/* Output: *\/\n.pcss-3aa0f0fc{padding:5px 5px 15px 50px}\n<\/code><\/pre>\n\n<h4>Supports CSS nesting<\/h4>\n\n<pre><code>[block] {\n  padding: 1rem;\n  a {\n    color: red;\n  }\n  background: white;\n  \/* Including media queries *\/\n  @media (prefers-color-scheme: dark) {\n    background: black;\n    color:white;\n  }\n}\n\n\/* Output: *\/\n.pcss-f526bb2d{background:#fff;padding:1rem;&amp; a{color:red}@media (prefers-color-scheme:dark){&amp;{color:#fff;background:#000}}}\n<\/code><\/pre>\n\n<p>Check browser support for <a href=\"https:\/\/caniuse.com\/css-nesting\">CSS nesting<\/a><\/p>\n\n<!--section=installation-->\n<ol>\n<li>Activate the plugin through the 'Plugins' screen in WordPress<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"error%20about%20application%2Fwasm%20mime%20type\"><h3>Error about application\/wasm mime type<\/h3><\/dt>\n<dd><p>Your server needs to be able to identify the mime type being used. See here: https:\/\/wordpress.org\/support\/topic\/webassembly-instantiatestreaming-failed-because-your-server-does-not-serve-wasm\/<\/p><\/dd>\n<dt id=\"can%20i%20use%20something%20other%20than%20%5Bblock%5D%3F\"><h3>Can I use something other than [block]?<\/h3><\/dt>\n<dd><p>You can add a custom selector via a PHP constant. It requires setting a type (type, attribute, etc) and the name.<\/p>\n\n<p>Here's an example for \"foo { color: red }\", where foo will be replaced with .pcss-h3Hso39bsK (or something similar):<\/p>\n\n<p>Add this to functions.php:<\/p>\n\n<pre><code>define('PATTERN_CSS_SELECTOR_OVERRIDE', ['name' =&gt; 'foo', 'type' =&gt; 'type']);\n<\/code><\/pre><\/dd>\n<dt id=\"can%20i%20manually%20set%20the%20class%20id%3F\"><h3>Can I manually set the class ID?<\/h3><\/dt>\n<dd><p>By default, class IDs are auto-generated. If you need to manually set or change a block's class ID (e.g. to match an existing class), you can enable this by adding the following constant to wp-config.php or functions.php:<\/p>\n\n<pre><code>define('PATTERN_CSS_ALLOW_MANUAL_OVERRIDE', true);\n<\/code><\/pre>\n\n<p>Once enabled, the ID field in the Advanced panel becomes editable. Type your desired class name and press \"Apply\" to save it. The value will be slugified automatically.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.5.5 - 2026-03-24<\/h4>\n\n<ul>\n<li>Added manual class ID override (opt-in via constant)<\/li>\n<li>Warns when duplicate class IDs are detected in the editor<\/li>\n<li>Prevents duplicate inline styles on the frontend<\/li>\n<li>Switched to Biome for linting and formatting<\/li>\n<li>Switched to Playwright and WP Playground for testing<\/li>\n<\/ul>\n\n<h4>1.5.4 - 2026-03-23<\/h4>\n\n<ul>\n<li>Fixed dynamic blocks with POST<\/li>\n<\/ul>\n\n<h4>1.5.3 - 2025-09-27<\/h4>\n\n<ul>\n<li>Fixes an issue where filtered attributes sent wp\/v2\/block-renderer causes a block validation error<\/li>\n<\/ul>\n\n<h4>1.5.2 - 2025-05-21<\/h4>\n\n<ul>\n<li>Fixes an overflow bug in the editor<\/li>\n<\/ul>\n\n<h4>1.5.1 - 2025-05-18<\/h4>\n\n<ul>\n<li>Retagging for release<\/li>\n<\/ul>\n\n<h4>1.5.0 - 2025-05-18<\/h4>\n\n<ul>\n<li>Adds support for global styles via a new editor<\/li>\n<\/ul>\n\n<h4>1.4.0 - 2025-05-12<\/h4>\n\n<ul>\n<li>Adds a draggable, resizable popout mode<\/li>\n<li>Updates CSS engine to include recent CSS features<\/li>\n<li>Allows \"supports\" support scoped to the block<\/li>\n<\/ul>\n\n<h4>1.3.0 - 2025-01-27<\/h4>\n\n<ul>\n<li>Switches to useStyleOverride for injecting styles<\/li>\n<\/ul>\n\n<h4>1.2.6 - 2024-09-20<\/h4>\n\n<ul>\n<li>Removes an unecessary html escape that mangled some css.<\/li>\n<\/ul>\n\n<h4>1.2.5 - 2024-07-28<\/h4>\n\n<ul>\n<li>Fixed a small bug where a block may not have attributes when we access them.<\/li>\n<\/ul>\n\n<h4>1.2.4 - 2024-07-21<\/h4>\n\n<ul>\n<li>Renamed the panel to Pattern CSS to differenciate it from the core panel on FSE<\/li>\n<\/ul>\n\n<h4>1.2.3 - 2024-05-09<\/h4>\n\n<ul>\n<li>Removed globals like @import, @font-face, and @keyframes (and others)<\/li>\n<\/ul>\n\n<h4>1.2.2 - 2024-04-19<\/h4>\n\n<ul>\n<li>Fixed an issue where CSS media queries using &lt;= were stripped out<\/li>\n<li>Removed loading the viewer for users without the edit_css cap<\/li>\n<li>Removed the tag stripping output - now only privlidged users can use<\/li>\n<li>Updated tests to run on modern WP (by disabling the iframe)<\/li>\n<\/ul>\n\n<h4>1.2.1 - 2024-02-22<\/h4>\n\n<ul>\n<li>Removed the example code and added a useful default<\/li>\n<li>Render blocks now work - now adds the id to the main class list<\/li>\n<\/ul>\n\n<h4>1.2.0 - 2024-02-20<\/h4>\n\n<ul>\n<li>Feature: Adds support for CSS nesting<\/li>\n<li>Removes the code example on focus and adds it back on blur (if empty)<\/li>\n<li>Lets users define an additional block selector<\/li>\n<li>Adds a notice that the site logo isn't currently supported<\/li>\n<\/ul>\n\n<h4>1.1.0 - 2024-02-18<\/h4>\n\n<ul>\n<li>Prevent adding classes to blocks unless CSS is added<\/li>\n<li>Force the settings area to the bottom (mainly for custom blocks)<\/li>\n<\/ul>\n\n<h4>1.0.1 - 2023-11-04<\/h4>\n\n<ul>\n<li>Fixed a bug where the it would crash on the pattern manager page<\/li>\n<\/ul>\n\n<h4>1.0.0 - 2023-07-15<\/h4>\n\n<ul>\n<li>Feature: Now supports reusable blocks\/patterns<\/li>\n<li>Update: Removed the \"per page\" functionality to limit the scope of this plugin to blocks and reusable patterns only<\/li>\n<li>Performance: Added global loading strategy to prevent per block n+1 loading issues<\/li>\n<li>Improvement: Added the option to update the CSS selector used for scoping (useful for duplicating blocks)<\/li>\n<li>Improvement: Added some examples when no CSS is present<\/li>\n<li>Improvement: Removed the public className attribute requirement from the Additional Settings area<\/li>\n<li>Improvement: Instead of saving as meta on a post, it now pulls from the attribute directly during page load (via the pre_render_block filter).<\/li>\n<li>Fix: Now it will only show on post types with the public setting set to true<\/li>\n<\/ul>","raw_excerpt":"Add a CSS editor to your blocks and patterns! Loads only where necessary. Supports adding global CSS too.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/183876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=183876"}],"author":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/kbat82"}],"wp:attachment":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=183876"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=183876"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=183876"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=183876"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=183876"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=183876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}