"styles":[...] in angular.json not working - json

I have been trying to implement Angular Material in my project and I imported a prebuilt theme in styles.scss. But that didn't work. So I tried to add it to angular.json file but seems that that didn't work out either. Then I finally figured out that whatever added in the "styles":[] in angular.json didn't work in my project(even styles.scss is not working). Does anyone know what might be the issue?
My angular.json file
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"unified-product-assessment": {
"projectType": "application",
"schematics": {
"#schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "ngx-build-plus:browser",
"options": {
"outputPath": "dist/unified-product-assessment",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets/"
],
"styles": [
{
"input":"node_modules/#angular/material/prebuilt-themes/indigo-pink.css"
},
"src/styles.scss"
],
"scripts": [],
"extraWebpackConfig": "webpack.config.js",
"commonChunk": false
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "7kb",
"maximumError": "10kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all",
"extraWebpackConfig": "webpack.prod.config.js"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "ngx-build-plus:dev-server",
"configurations": {
"production": {
"browserTarget": "unified-product-assessment:build:production",
"extraWebpackConfig": "webpack.prod.config.js"
},
"development": {
"browserTarget": "unified-product-assessment:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"port": 5000,
"publicHost": "http://localhost:5000",
"extraWebpackConfig": "webpack.config.js"
}
},
"extract-i18n": {
"builder": "ngx-build-plus:extract-i18n",
"options": {
"browserTarget": "unified-product-assessment:build",
"extraWebpackConfig": "webpack.config.js"
}
},
"test": {
"builder": "ngx-build-plus:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "#angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"cli": {
"analytics": "85c84fd2-00e2-4930-b2a7-4da897f60d34",
"schematicCollections": [
"#angular-eslint/schematics"
]
}
}

Try using this format:
"styles": [
"./node_modules/#angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
Also do not forget to restart the application with ng serve for changes to apply.

Related

Angular 11 and ng2-charts

I decide to install ng2-charts for my Angular project: https://valor-software.com/ng2-charts/
The main problem is when I update angular.json file, the compiler gave me several errors, as it follows:
barras.component.ts
import { Component, OnInit } from '#angular/core';
import { ChartDataSets } from 'chart.js';
import { ChartOptions, ChartType } from 'chart.js';
import { Label } from 'ng2-charts';
#Component({
selector: 'app-barras',
templateUrl: './barras.component.html',
styles: [
]
})
export class BarrasComponent implements OnInit {
public barChartOptions: ChartOptions = {
responsive: true,
// We use these empty structures as placeholders for dynamic theming.
scales: { xAxes: [{}], yAxes: [{}] },
plugins: {
datalabels: {
anchor: 'end',
align: 'end',
}
}
};
public barChartLabels: Label[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
public barChartType: ChartType = 'bar';
public barChartLegend = true;
public barChartPlugins = [pluginDataLabels];
public barChartData: ChartDataSets[] = [
{ data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
{ data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' }
];
constructor() { }
ngOnInit(): void {
}
public randomize(): void {
// Only Change 3 values
this.barChartData[0].data = [
Math.round(Math.random() * 100),
59,
80,
(Math.random() * 100),
56,
(Math.random() * 100),
40 ];
}
package.json
"dependencies": {
"#angular/animations": "~11.2.9",
"#angular/common": "~11.2.9",
"#angular/compiler": "~11.2.9",
"#angular/core": "~11.2.9",
"#angular/forms": "~11.2.9",
"#angular/platform-browser": "~11.2.9",
"#angular/platform-browser-dynamic": "~11.2.9",
"#angular/router": "~11.2.9",
"chart.js": "^3.2.1",
"ng2-charts": "^2.4.2",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"graficasApp": {
"projectType": "application",
"schematics": {
"#schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["chart.js"],
"outputPath": "dist/graficasApp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "graficasApp:build"
},
"configurations": {
"production": {
"browserTarget": "graficasApp:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "graficasApp:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "graficasApp:serve"
},
"configurations": {
"production": {
"devServerTarget": "graficasApp:serve:production"
}
}
}
}
}
},
"defaultProject": "graficasApp"
}
Angular CLI Windows console
What is the best way to solve this kind of graph package?
Try installing the Chart.js types package. npm i #types/chart.js.
The types definition package is here: https://www.npmjs.com/package/#types/chart.js.

Angular8 : ng run => 'Project target does not exist.' when using i18n

Based on those tutorials :
https://angular-templates.io/tutorials/about/angular-internationalization-i18n-multi-language-appand https://medium.com/#ismaestro/angular-7-example-app-with-angularcli-angular-universal-i18n-official-firebase-66deac2dc31e
I'm trying to build and use an Angular 8 app using i18n as internationalisation system.
However, when I try to run npm build:ssr (cfr. below), I get An unhandled exception occurred: Project target does not exist.
Here, the angular.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"boilerplate": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"en": {
"outputPath": "dist/browser/",
"baseHref": "/",
"i18nFile": "src/locale/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
]
},
"fr": {
"outputPath": "dist/browser/",
"baseHref": "/fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
]
},
"production-en": {
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/browser/",
"baseHref": "/",
"i18nFile": "src/locale/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error"
},
"production-fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/browser/fr/",
"baseHref": "/fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "boilerplate:build:production-en"
},
"configurations": {
"fr": {
"browserTarget": "boilerplate:build:production-fr"
},
"en": {
"browserTarget": "boilerplate:build:production-en"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "boilerplate:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"boilerplate-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "boilerplate:serve"
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "boilerplate",
"schematics": {
"#schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"#schematics/angular:directive": {
"prefix": "app"
}
}
}
and a part of the package.json:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"lint": "ng lint boilerplate",
"build:prod:en": "ng build --configuration=production-en",
"build:prod:fr": "ng build --configuration=production-fr",
"build:server:prod:en": "ng run boilerplate:server:production-en",
"build:server:prod:fr": "ng run boilerplate:server:production-fr",
"build:library": "ng build ngx-example-library",
"build:client-and-server-bundles": "npm run build:prod:en && npm run build:prod:fr && npm run build:server:prod:en && npm run build:server:prod:fr",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:ssr": "node dist/server"
},
As previously explain, I would like to successfully run my Angular application with i18n. But the error message is:
[error] Error: Project target does not exist.
at WorkspaceNodeModulesArchitectHost.getBuilderNameForTarget (/Users/user$
at RunCommand.runSingleTarget (/Users/user/Desktop/Boilerplate/boilerpla$
at RunCommand.runArchitectTarget (/Users/user/Desktop/Boilerplate/boiler$
at RunCommand.run (/Users/user/Desktop/Boilerplate/boilerplate/node_modu$
at RunCommand.validateAndRun (/Users/user/Desktop/Boilerplate/boilerplat$
at process._tickCallback (internal/process/next_tick.js:43:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:778:11)
at startup (internal/bootstrap/node.js:300:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
If someone already had the same issue and could explain me what I'm doing wrong ? Thx
I found this. The problem is:
1) you are missing architect config in angular.json file.
2) There is a problem at your browserTarget. The target must point to the project, not to Angular.
1) Please add these line to angular.json file => project => {{your project name}} => achitect: (remember to replace"{{project name}}"` to your project name)
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/"{{project name}}"/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": true
}
}
},
"serve-ssr": {
"builder": "#nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": ""{{project name}}":build",
"serverTarget": ""{{project name}}":server"
},
"configurations": {
"production": {
"browserTarget": ""{{project name}}":build:production",
"serverTarget": ""{{project name}}":server:production"
}
}
},
"prerender": {
"builder": "#nguniversal/builders:prerender",
"options": {
"browserTarget": ""{{project name}}":build:production",
"serverTarget": ""{{project name}}":server:production",
"routes": [
"/"
]
},
"configurations": {
"production": {}
}
}
2) Make sure you have #nguniversal/express-engine and #nguniversal/builders in your package.json:
npm i #nguniversal/express-engine #nguniversal/builders -D
I have solved it using below command:
ng add #ionic/cordova-builders
Source: ionic forum
I had the same problem and my fix was to add the "server" information.
because this line
"build:client-and-server-bundles": "ng build --prod && ng run ngkol:server:production",
this is trying to run ng run ngkol:server:production <<<
"projects": {
"ngkol": {
"projectType": "application",
"schematics": {},
"root": "src",
"sourceRoot": "src",
"prefix": "app",
"architect": {
//2019-08-23 here goes your other info
// build, serve,extract-i18n, options, lint, e2e,
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}]
}
}
}
here my app running https://www.supercolegas.com/soon
I got this error because my project name was slightly different from the name of my working directory.
Because of this, when I wrote in the 'project name' as this answer advised, I was writing in the name of my project's directory and not the name of the project itself.
The name of the project can be confirmed in the angular.json file in the projects object.
you can try this:
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json" -------- Try to Replace tsconfig.server.json by tsconfig.app.json -------------
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}]
}
}
}

Image not getting referenced from html in angular

In my angular project, I am referencing an image(book.svg) in test.component.html file, which is not working at all. In the console, it references to localhost:4200:/assets/book.svg and hence it is unable to find it
We have kind a different structure of project, with libs and apps as shown.
Please let me know where the problem is and how to fix this.
Have used require() to make it work, but this fails the test cases so not looking for require().
<button mat-icon-button >
<a class="reference-route" routerLink="reference" title="Reference">
<img class="reference-image" src="./assets/book.svg" />
</a>
</button>
the code structure:
project
----------apps
-------------xyz-frontend
-------------src
-------------assets
----------book.svg
----------libs
-------------shared
-------------shared-ui
-------------src
----------lib
----------test
----------test.component.ts
----------test.component.html
----------assets
----------book.svg
angular.json
"projects": {
"xyz-frontend": {
"root": "apps/xyz-frontend/",
"sourceRoot": "apps/xyz-frontend/src",
"projectType": "application",
"prefix": "apps/xyz-frontend",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"index": "apps/xyz-frontend/src/index.html",
"main": "apps/xyz-frontend/src/main.ts",
"polyfills": "apps/xyz-frontend/src/polyfills.ts",
"tsConfig": "apps/xyz-frontend/tsconfig.app.json",
"assets": [
"apps/xyz-frontend/src/favicon.ico"
],
"styles": [
"apps/xyz-frontend/src/styles.scss",
"libs/shared/shared-styles/src/themes/a4a-theme.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/xyz-frontend/src/environments/environment.ts",
"with": "apps/xyz-frontend/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "xyz-frontend:build"
},
"configurations": {
"production": {
"browserTarget": "xyz-frontend:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "xyz-frontend:build"
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/xyz-frontend/tsconfig.app.json",
"apps/xyz-frontend/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"shared-assets": {
"root": "libs/shared/shared-assets",
"sourceRoot": "libs/shared/shared-assets/src",
"projectType": "library"
},
"shared-ui": {
"root": "libs/shared/shared-ui",
"sourceRoot": "libs/shared/shared-ui/src",
"projectType": "library",
"prefix": "xyz",
"architect": {
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "libs/shared/shared-ui/src/test.ts",
"tsConfig": "libs/shared/shared-ui/tsconfig.spec.json",
"karmaConfig": "libs/shared/shared-ui/karma.conf.js"
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/shared/shared-ui/tsconfig.lib.json",
"libs/shared/shared-ui/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
Normally, your import should look like:
<img class="reference-image" src="assets/book.svg" />
How's your angular.json file assets part looks like?
In Angular 6+ it should be like:
...
"assets": [
"src/favicon.ico",
"src/assets",
// ...
],
...

how to import multiple images in scss

I'm trying to Import multiple images in scss file but after i run the application i got this error
File to import not found or unreadable: ../../../images/sprite/*.png.
#import '../../../images/sprite/*.png';
folder structure
--app
--asset
--images
--sprite
i used the default angular.json create by the cli also i added the assest/image folder in the assets array
angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"aumet": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"#schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "#angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "extrawebpack.config.js"
},
"outputPath": "dist/aumet",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/images"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "#angular-builders/dev-server:generic",
"options": {
"browserTarget": "aumet:build"
},
"configurations": {
"production": {
"browserTarget": "aumet:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "aumet:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"aumet-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "aumet:serve"
},
"configurations": {
"production": {
"devServerTarget": "aumet:serve:production"
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "aumet"
}
By Using Forloop Method To import Multiple Images

All vendor CSS are rendered as style tag in the top of html in Angular 4 application

In my Angular 4 project i have included Bootstrap, Fontawesome and some my own CSS but everything is rendering as tag in the top of my index.html. I expect all of them minimize and include as a bundle CSS in the file please refer the image attached for more clarification
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "test"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/omega/theme.css"
],
"scripts": ["../node_modules/bootstrap/dist/js/bootstrap.min.js"],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
The css vendors are being added as style elements by the javascript bundle files .
You need to compile your application with the --extract-css options, which will create single .css files