npm

@eighteen73/tailwindcss-wordpress

1.2.0 • Public • Published

Tailwind CSS WordPress Utilities

This Package contains a number of utilities for working with TailwindCSS and WordPress.

Install

Install the plugin:

# Using npm
npm install @eighteen73/tailwindcss-wordpress --save-dev

# Using Yarn
yarn add @eighteen73/tailwindcss-wordpress -D

Available Utilities

themeJson()

This function can be required in your tailwind.config.js file to pull in values from your themes theme.json file.

Firstly require themeJson:

// tailwind.config.js
const { themeJson } = require('@eighteen73/tailwindcss-wordpress');

This function expects a dot notation string to mimic the structure of theme.json. For example, to pass Tailwind the color palette:

// theme.json
"settings": {
// ...
  "color": {
    "palette": [
      {
        "name": "Primary",
        "slug": "primary",
        "color": "#DD93B5"
      },
      {
        "name": "Secondary",
        "slug": "secondary",
        "color": "orange"
      },
      {
        "name": "Tertiary",
        "slug": "tertiary",
        "color": "#0F5B66"
      }
    ],
// ...
// tailwind.config.js
module.exports = {
	// ...
	theme: {
		colors: themeJson('settings.color.palette'),
	},
};

This returns an object set up to match Tailwinds required format.

Package Sidebar

Install

npm i @eighteen73/tailwindcss-wordpress

Weekly Downloads

7

Version

1.2.0

License

MIT

Unpacked Size

8.96 kB

Total Files

13

Last publish

Collaborators

  • daniel.hudson
  • edjeavons
  • brettsmason