After upgrading angular, fileReplacements is not working anymore with assets, here is my code :
"fileReplacements": [
{
"replace": "src/assets/scss/x.scss",
"with": "src/assets/scss/app.scss"
},
]
and i tried this
"assets": [
{
"input": "src/assets/scss/x",
"output": "assets/scss/",
"glob": "app.scss"
},
]
how to resolve this and can replace my file while building the project with specefic configuration
You can't do it using
fileReplacementsbut you can achieve it in this way.First, in your
angular.jsonfile, you can usestylePreprocessorOptionsthis way:Now, you can create two files for an example in
src/assets/styles/folderForProduction/and insrc/assets/styles/folderForDevelopand put something like:in both of them. For develop change the
colorto be blue instead.now you can run your application both ways:
ng serve --configuration developmentand you will see the color blue.ng serve --configuration productionand you will see the color red.