Skip to content

Commit

Permalink
feat(webpack): use newest cssnano for css optimization
Browse files Browse the repository at this point in the history
and add cssnano config in project
  • Loading branch information
ernscht committed Mar 25, 2024
1 parent ef4eb89 commit 9f9a1ea
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 384 deletions.
606 changes: 231 additions & 375 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: [
'default',
// if the cssnano optimisation causes issues, features can be configured here
// see https://cssnano.github.io/cssnano/docs/what-are-optimisations/
// {
// cssDeclarationSorter: false,
// },
]
};
2 changes: 1 addition & 1 deletion packages/nitro-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"autoprefixer": "10.4.19",
"case-sensitive-paths-webpack-plugin": "2.4.0",
"css-loader": "5.2.7",
"cssnano": "6.1.1",
"file-loader": "6.2.0",
"handlebars-loader": "1.7.3",
"iconfont-webpack-plugin": "5.0.1",
"imagemin": "7.0.1",
"img-loader": "4.0.0",
"js-config-webpack-plugin": "2.0.3",
"mini-css-extract-plugin": "1.6.2",
"optimize-css-assets-webpack-plugin": "6.0.1",
"postcss": "8.4.38",
"postcss-loader": "4.3.0",
"resolve-url-loader": "5.0.0",
Expand Down
9 changes: 1 addition & 8 deletions packages/nitro-webpack/webpack-config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const JsConfigWebpackPlugin = require('js-config-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
const WebpackBar = require('webpackbar');
const DynamicAliasResolverPlugin = require('../plugins/dynamicAliasResolver');
Expand Down Expand Up @@ -143,6 +142,7 @@ module.exports = (options = { rules: {}, features: {} }) => {
// grid: 'autoplace': enable autoprefixer grid translations and include autoplacement support.
// not enabled - use `/* autoprefixer grid: autoplace */` in your css file
}),
require('cssnano'),
],
};
},
Expand All @@ -163,13 +163,6 @@ module.exports = (options = { rules: {}, features: {} }) => {
filename: 'css/[name].min.css',
chunkFilename: 'css/[name]-[contenthash:7].min.css',
}),
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
map: {
inline: false,
},
},
})
);
}

Expand Down
10 changes: 10 additions & 0 deletions packages/project-nitro-twig/cssnano.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: [
'default',
// if the cssnano optimisation causes issues, features can be configured here
// see https://cssnano.github.io/cssnano/docs/what-are-optimisations/
// {
// cssDeclarationSorter: false,
// },
]
};
10 changes: 10 additions & 0 deletions packages/project-nitro-typescript/cssnano.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: [
'default',
// if the cssnano optimisation causes issues, features can be configured here
// see https://cssnano.github.io/cssnano/docs/what-are-optimisations/
// {
// cssDeclarationSorter: false,
// },
]
};
10 changes: 10 additions & 0 deletions packages/project-nitro/cssnano.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: [
'default',
// if the cssnano optimisation causes issues, features can be configured here
// see https://cssnano.github.io/cssnano/docs/what-are-optimisations/
// {
// cssDeclarationSorter: false,
// },
]
};

0 comments on commit 9f9a1ea

Please sign in to comment.