Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How configure inline style and html template in `angular.json`?

It look like all tutorials show how config it in the old angular.cli.json format.

"defaults": {
  "styleExt": "css",
  "component": {
    "inlineStyle":true,
    "inlineTemplate":true
  }
}

but not in the angular.json format. and that arises the error Workspace needs to be loaded before it is used

So how I can change the configuration of an existing project to generate component with an inline template and CSS/SCSS

Thanks.

like image 491
pery mimon Avatar asked Jan 02 '23 01:01

pery mimon


1 Answers

After researching the angular CLI command and generate a new project with that setting I come with that solution :

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "project-name": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {
        "@schematics/angular:component": {
          "inlineTemplate": true,
          "inlineStyle": true,
          "styleext": "scss"
        }
      }, ....
}
like image 83
pery mimon Avatar answered Mar 05 '23 17:03

pery mimon