4

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.

Sagar Zala
  • 4,854
  • 9
  • 34
  • 62
pery mimon
  • 7,713
  • 6
  • 52
  • 57

1 Answers1

9

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"
        }
      }, ....
}
pery mimon
  • 7,713
  • 6
  • 52
  • 57