- https://underscores.me/
- Ensure
Sassify
is clicked
# Using npm
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
# 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
touch webpack.mix.js
let mix = require('laravel-mix');
let 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": "mix",
"mix-watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production",
}
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: [],
}