Here's a solution using the ngx-build-plus pkg. (ng version: 9.1.6 )
- add
ngx-build-plusto your angular project:
ng new myapp --style=scss --routing
cd myapp
ng add ngx-build-plus
- create a
webpack.partial.jsfile in root of the project directory, and put the following in it:
const rtlcss = require('rtlcss');
const autoprefixer = require('autoprefixer');
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
{
loader: 'postcss-loader',
options: {
postcssOptions: {plugins: [autoprefixer, rtlcss]}
}
},
'sass-loader',
],
},
],
},
};- install required packages:
npm i postcss postcss-loader rtlcss autoprefixer -D - run
ng serve --extra-webpack-config webpack.partial.js -o
Done.
Now all of your *.scss files will go through rtlcss and autoprefixer.
Hi, does this solution require to have webpack installed? I'm using Angular CLI 13 and even if I'm doing everything as you said, it says that they can't find the module. I can't understand what's missing. (also I'm new to all this)