Site: https://deploy-preview-2--delusioninabox.netlify.app/ (preview branch of delusioninabox.com)
Deploy Log: Netlify App
My site is built with middleman and uses webpack to use postcss & tailwind. I have a branch I’m working on which I updated a lot of gems to make the site up to date, and everything works locally. When the site deploys though, the tailwind css from the config is missing. It has some styles – like container
and it’s breakpoints – but others, such as the styles for colors or margins, are missing.
When I run my build command locally (middleman build --verbose
) all the styles are there. So I’m not sure what is happening that they’re missing from the deployed version. I’m wondering if my tailwind config needs an adjustment? I tried adding a npx tailwindcss
command to the build process, but then it was creating a conflict with the cascade being read properly, so I would prefer it works in the proper order in webpack like it does locally.
webpack build in config.rb:
activate :external_pipeline,
name: :webpack,
command: build? ? './node_modules/webpack/bin/webpack.js --bail' : './node_modules/webpack/bin/webpack.js --watch --devtool source-map --color',
source: ".tmp/dist",
latency: 1
postcss.config.js
module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('autoprefixer'),
require("postcss-minify")
]
}
webpack.config.js
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: 'production',
entry: {
application: './source/javascripts/application.js',
styles: './source/stylesheets/styles.css',
},
//resolve: {
//root: __dirname + '/source/javascripts',
//},
output: {
path: __dirname + '/.tmp/dist',
filename: 'javascripts/[name].js',
},
plugins: [new MiniCssExtractPlugin()],
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 2 } },
{ loader: 'sass-loader' },
{ loader: 'postcss-loader' },
]
}
],
},
}
tailwind.config.js (minus theme styles)
module.exports = {
content: ["./build/**/*.{html,js}", "./source/**/*.{html,js}"],
presets: [],
darkMode: 'media', // or 'class'
options: {
prefix: '',
important: false,
},
plugins: [],
}
I’ve been trying a lot of combinations of things and not having any luck, so any help if appreciated! I wondered in the content path needs to be different for Netlify in the tailwind config? I wonder if the base @tailwind
imports are working, but those generated from the config are not? But I’m not clear on why it works locally in dev and production mode, but just not once built in Netlify.
I did notice that in my local build log, there is a generated tailwind
js file that does not get built on Netlify.
Thank you in advance!!