Merge pull request #11 from MarcoGlauser/master

update webpack config to work with current dependencies
This commit is contained in:
Calvin Koepke 2020-09-28 09:24:40 -06:00 committed by GitHub
commit 6c1e480753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,16 +35,17 @@ if ( isProduction ) {
css: [ css: [
'./node_modules/tailwindcss/dist/base.css' './node_modules/tailwindcss/dist/base.css'
], ],
extractors: [ // Use Extractor configuration from Tailwind Docs
{ // https://tailwindcss.com/docs/controlling-file-size#setting-up-purge-css-manually
extractor: class TailwindExtractor { defaultExtractor: content => {
static extract(content) { // Capture as liberally as possible, including things like `h-(screen-1.5)`
return content.match(/[A-Za-z0-9-_:\/]+/g) || []; const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
}
}, // Capture classes within other delimiters like .block(class="w-1/2") in Pug
extensions: ['php', 'js', 'svg', 'css',] const innerMatches = content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || []
}
], return broadMatches.concat(innerMatches)
},
whitelistPatterns: getCSSWhitelistPatterns() whitelistPatterns: getCSSWhitelistPatterns()
}) })
) )
@ -87,7 +88,6 @@ const config = {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
importLoaders: 1, importLoaders: 1,
context: 'postcss',
sourceMap: ! isProduction sourceMap: ! isProduction
} }
}, },
@ -113,13 +113,17 @@ const config = {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: `[name]${prefix}.css`, filename: `[name]${prefix}.css`,
}), }),
new CopyWebpackPlugin([{ new CopyWebpackPlugin({
from: './assets/images/', patterns: [{
to: 'images', from: './assets/images/',
ignore: [ to: 'images',
'.DS_Store' globOptions: {
] ignore: [
}]), '**/.DS_Store'
]
}
}]
}),
new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }) new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i })
] ]
} }