This project uses jekyll-postcss to compile Tailwind CSS for you.
You can use any PostCSS plugin by installing it with yarn
or npm
and adding it to your postcss.config.js.
The jekyll-purgecss plugin is used to integrate Purgecss (only in production).
$ bundle config set --local path vendor/bundle
$ bundle install
$ yarn install
$ bundle exec jekyll serve --trace --livereload
$ JEKYLL_ENV=production bundle exec jekyll build --trace
In a new project, setup your config files as below.
Add these gems to your Gemfile. By using the plugins group as below, they will be enabled without being added to plugins
in your config.
group :jekyll_plugins do
gem "jekyll-postcss"
gem "jekyll-purgecss"
end
Update the version numbers to whatever is currently latest.
{
"devDependencies": {
"autoprefixer": "^9.3.1",
"postcss-cli": "^6.0.1",
"postcss-import": "^12.0.1",
"purgecss": "^1.1.0",
"tailwindcss": "^1.0.0"
}
}
module.exports = {
plugins: [
require("postcss-import"),
require("tailwindcss")("./_includes/tailwind.config.js"),
require("autoprefixer")
]
}
module.exports = {
content: ["./_site/**/*.html"],
css: ["./_site/css/site.css"],
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
};
$ yarn run tailwind init _includes/tailwind.config.js