Skip to content

Instantly share code, notes, and snippets.

@annacoding2020
Created March 29, 2020 20:20
Show Gist options
  • Select an option

  • Save annacoding2020/528b4f35b8efd53c9937e419e6af1480 to your computer and use it in GitHub Desktop.

Select an option

Save annacoding2020/528b4f35b8efd53c9937e419e6af1480 to your computer and use it in GitHub Desktop.
const path = require('path');
const withLess = require('@zeit/next-less');
const withPlugins = require('next-compose-plugins');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CleanCss = require('clean-css');
const nextConfig = {
webpack(config) {
config.module.rules.push({
test: /\.(png|svg|eot|otf|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 8192,
publicPath: '/_next/static/',
outputPath: 'static/',
name: '[name].[ext]',
},
},
});
config.resolve.alias['../../theme.config$'] = path.join(config.context, '/semantic-ui/theme.config');
config.plugins.push(
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: CleanCss,
cssProcessorOptions: {
sourceMap: true,
},
canPrint: true,
})
);
return config;
},
};
const plugins = [withLess];
module.exports = withPlugins(plugins, nextConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment