Skip to content

Save your tailwind.config.js as a PHP file.

License

Notifications You must be signed in to change notification settings

vendeka-nl/tailwind-config-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use your TailwindCSS config in PHP

npm (scoped)

Installation

npm install --global @vendeka/tailwind-config-php

Usage

Browse to the directory where your TailwindCSS config file is located and execute:

tw2php

By default it reads tailwind.config.js and writes to tailwind.config.php. You can override the file names using the --config/-c and --output/-o options.

tw2php -c tailwind.js -o config/tailwind.php
tw2php --config tailwind.js --output config/tailwind.php

Now you can use the resolved config in your PHP as an object.

<?php
$tailwind = require 'tailwind.config.php';
$tailwind->theme->colors->gray->{500};

Please remember that the PHP file does not automatically update.