PostCSS plugin to render WordPress global styles from a theme.json file

Overview

postcss-wp-global-styles

PostCSS plugin to render WordPress global styles from a theme.json file.

As of now it only supports preset styles.

Usage

@wp-global-styles;

Result

:root{
  --wp--preset--color--foreground: #000000;
  --wp--preset--color--background: #ffffff;
  --wp--preset--color--primary: #1a4548;
  --wp--preset--color--secondary: #ffe2c7;
  --wp--preset--color--tertiary: #F6F6F6;
}

.has-foreground-color{
  color: #000000;
}

.has-foreground-background-color{
  background-color: #000000;
}

.has-foreground-border-color{
  border-color: #000000;
}

.has-background-color{
  color: #ffffff;
}

.has-background-background-color{
  background-color: #ffffff;
}

.has-background-border-color{
  border-color: #ffffff;
}

.has-primary-color{
  color: #1a4548;
}

.has-primary-background-color{
  background-color: #1a4548;
}

.has-primary-border-color{
  border-color: #1a4548;
}

.has-secondary-color{
  color: #ffe2c7;
}

.has-secondary-background-color{
  background-color: #ffe2c7;
}

.has-secondary-border-color{
  border-color: #ffe2c7;
}

.has-tertiary-color{
  color: #F6F6F6;
}

.has-tertiary-background-color{
  background-color: #F6F6F6;
}

.has-tertiary-border-color{
  border-color: #F6F6F6;
}

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-wp-global-styles

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-wp-global-styles'),
    require('autoprefixer')
  ]
}
You might also like...

Cyberpunk Store - online supermarket project, using cyberpunk inspired theme.

Cyberpunk Store - online supermarket project, using cyberpunk inspired theme.

if you downloaded the project from GITHUB TO START THE PROJECT WITHOUT ERRORS - Copy/Cut the "assets" folder into "Client/src/" folder (i threw the

Jan 2, 2022

This stylesheet customizes Jupyter Notebooks to a dark-theme with vibrant pink, blue, and lime accents.

This stylesheet customizes Jupyter Notebooks to a dark-theme with vibrant pink, blue, and lime accents.

jupyter-dragonfruit-theme This stylesheet customizes Jupyter Notebooks to a dark-theme with vibrant pink, blue, and lime accents. Author Website Conta

Jan 29, 2022

Lavender - A purple powercord theme

Lavender - A purple powercord theme

Lavender A good looking dark purple-ish theme for discord. If you got any sugges

Jan 6, 2023

Monkeytype - Soothing pastel theme for MonkeyType

Monkeytype - Soothing pastel theme for MonkeyType

Catppuccin for MonkeyType Usage Open settings on monkeytype.com Go to the theme

Dec 22, 2022

A simple, performance-first, SEO-friendly Hugo theme

A simple, performance-first, SEO-friendly Hugo theme

Hugo Theme Luna A simple, performance-first, SEO-friendly Hugo theme 👉 Example | 中文文档 Introduction Using Tailwindcss Custom Themes Many shortcodes Da

Jan 5, 2023

Standalone keycloak theme using Système de Design de l'État (french government design system)

keycloak-dsfr This template has been made thanks to keycloakify. It follows the french design system Système de Design de l'État. You can find guideli

May 25, 2022

implementing a hook to listen to system theme changes! it could be a good lib, who knows? 😏

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Jan 15, 2022

Easily create css variables without the need for a css file!

Tailwind CSS Variables This plugin allows you to configure CSS variables in the tailwind.config.js Similar to the tailwindcss configurations you are u

Dec 22, 2022

Automatically convert those LESS file which is not using less function to CSS.

Automatically convert those LESS file which is not using less function to CSS.

less-2-css Automatically convert those .less file which is not using less function to .css. Why Less is a powerful CSS pre-processor, but it also very

May 24, 2022
Releases(v0.2.2)
Owner
Luehrsen // Heinrich
Agentur für Medienkommunikation - WordPress, Social, Print
Luehrsen // Heinrich
A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.

Jonny Chen 15 Dec 29, 2022
Beautiful theme for Obsidian, Base on Minimal theme

?? obsidian_orange 是什么? obsidian_orange 是一款基于 minimal theme 定制的主题。 ✨ obsidian_orange 实现了什么功能? 多样式“提示块” 图片并列显示 高亮块 & 文本多颜色高亮 徽章(Badge):在标题或文本的右上角添加状态信息

echoxu 84 Jan 6, 2023
Firefox theme that is minimalist, customizable and theme-compatible.

Oneliner Deluxe Installation 1. Download .zip Click the green 'Code' button above and then 'Download ZIP' 2. Copy files Extract contents of @programFi

null 11 Jul 21, 2022
Author styles collocated in JS, pull them out into static CSS on build. No runtime dependency.

Author styles collocated in JS, pull them out into static CSS on build. No runtime dependency. the big idea: I like to author styles collocated with c

Siddharth Kshetrapal 90 Sep 11, 2022
Jason Johnston 2.8k Dec 26, 2022
Jekyll Bootstrap theme

Landing Page Jekyll theme Jekyll theme based on landing-page bootstrap theme How to use Place a image in /img/services/ Create posts to display your s

Shane Weng 412 Dec 3, 2022
A web app landing page theme created by Start Bootstrap

Start Bootstrap - New Age New Age is a web app landing page theme for Bootstrap created by Start Bootstrap. Preview View Live Preview Status Download

Start Bootstrap 996 Dec 26, 2022
A modern static resume template and theme. Powered by Jekyll and GitHub pages.

modern-resume-theme A modern simple static resume template and theme. Powered by Jekyll and GitHub pages. Host your own resume on GitHub for free! Vie

James Grant 1.5k Dec 31, 2022
A clean, elegant and advanced blog theme for Hugo.

DoIt Theme | Hugo English README | 简体中文说明 DoIt is a clean, elegant and advanced blog theme for Hugo. It is based on the LoveIt Theme, LeaveIt Theme an

PCloud 398 Jan 8, 2023
Orange Design System theme for Storybook

ODS Storybook Theme Orange Design System Storybook Theme provides a Storybook theme for Orange. Quick start Install with npm: npm install ods-storyboo

Orange 3 Jan 10, 2022