Skip to content

simkuns/webpack-media-query-split-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

webpack-media-query-split-plugin

Executed right before emitting assets to output dir.

Requires node.js^12.0.0, webpack 4

// webpack.config.js
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
const WebpackMediaQuerySplitPlugin = require( '@gunarssimkuns/webpack-media-query-split-plugin' )

module.exports = {
	module: {
		rules: [
			{
				test: /\.s?[ac]ss$/,
				use: [
					{ loader: MiniCssExtractPlugin.loader },
					{ loader: 'css-loader' },
					{ loader: WebpackMediaQuerySplitPlugin.loader },
					{ loader: 'postcss-loader' },
					{ loader: 'sass-loader' },
				]
			},
        ]
    },
    plugins: [
        new WebpackMediaQuerySplitPlugin({
            queries: {
                mobile: /\(max-width: 767px\)/,
                tablet: [ /\(min-width: 768px\)/ ]
            },
            filename: '[name]-[query].css'
        })
    ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published