Skip to content

Webpack configuration to use postcss-rtlcss with less and sass

Notifications You must be signed in to change notification settings

elchininet/postcss-rtlcss-less-and-sass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack configurations to use postcss-rtlcss plugin with Less and Sass

These are minimum Webpack configurations to use postcss-rtlcss plugin with Less and Sass

Using Less

const postcssRTLCSS = require('postcss-rtlcss');

module.exports = {
    ... // other webpack configurations
    module: {
        rules: [
            {
                test: /\.less$/,
                use: [
                    ... // other loaders
                    {
                        loader: 'postcss-loader',
                        options: {
                            postcssOptions: {
                                plugins: [
                                    postcssRTLCSS()
                                ]
                            }
                        }
                    },
                    // Less loader must come before postcss-loader
                    'less-loader'
                ]
            }
        ]
    }
};

Using Sass

const postcssRTLCSS = require('postcss-rtlcss');

module.exports = {
    ... // other webpack configurations
    module: {
        rules: [
            {
                test: /\.s(c|a)ss$/,
                use: [
                    ... // other loaders
                    {
                        loader: 'postcss-loader',
                        options: {
                            postcssOptions: {
                                plugins: [
                                    postcssRTLCSS()
                                ]
                            }
                        }
                    },
                    // Sass loader must come before postcss-loader
                    'sass-loader'
                ]
            }
        ]
    }
};