- https://underscores.me/
- Ensure
Sassify
is clicked
# Using npm
npm install tailwindcss
# Using Yarn
yarn add tailwindcss
- https://tailwindcss.com/docs/installation#2-add-tailwind-to-your-css
- Navigate to the
sass
directory - Open the
style.scss
file - Add the tailwind directives after the commented table of contents
- This will ensure your tailwind classes are generated before the included CSS, which allows you to use the
@apply
tailwind directive and use your utility classes in your WordPress styles
@tailwind base;
@tailwind components;
@tailwind utilities;
npx tailwindcss init
# Using npm
npm install laravel-mix --save-dev
# Using yarn
yarn add laravel-mix --dev
cp node_modules/laravel-mix/setup/webpack.mix.js ./
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss')
mix.sass('sass/style.scss', 'style.css')
.options({
processCssUrls: false,
postCss: [ tailwindcss('tailwind.config.js') ],
});
- https://laravel-mix.com/docs/5.0/installation#npm-scripts
- You will need to rename the Laravel Mix
watch
command because underscores also defines awatch
command - You will probably need to install
cross-env
as well
# Using npm
npm install cross-env --save-dev
# Using yarn
yarn add cross-env --dev
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"mix-watch": "npm run development -- --watch",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
npm run dev
- This is an example config, please edit to match your needs
module.exports = {
purge: [
'./inc/**/*.php',
'./js/**/*.js',
'./sass/**/*.scss',
'./template-parts/**/*.php',
],
theme: {
extend: {},
},
variants: {},
plugins: [],
}