Closed mmercure closed 6 years ago
@mmercure make sure you have a "styleext": "scss" defined in your angular.json default project level / not a global level (which usually the case when you upgrade it with angular-cli), then it should work perfectly.
I'm not sure of what you mean... I have my package.json at the root of my project.
when i run ng g my-component
it generates a flat component with htlm, scss, and ts file. Using the extension, it generates a folder with css, html, spec.ts and ts file.
my package.json files ends with the new schemantics configuration that i posted above.
Do I have to move the config to a different section? I thought that if ng generate works properly the extension would too.
The new angular.json format allows to define schematics on multiple levels, the global level (outside of the projects section) or in each project to give you an option having different configurations per project, currently this extensions supports only reading configuration on project level, and you have it defined outside your default project,when you create a new project angular cli will put the schematics definition in your default project , but when you upgrade from old format it will put it on the outside of projects level, currently only project level is supported by this extension , while angular cli just support both levels, just move your schematics definition to your default project and it would work
I tried moving the schemantic section into my project, wiath same result... I tried reinstalling Angular files extension. At one point it told me component created sucessfully, nut nothing got created. Anyway I guess I will just fallback to using ng generate.
I've been using your extension for a while and it was great... but now I can't get it to work properly... maybe an issue caused by other extension I don't know...
still thanx for the help.
@mmercure, not sure why it isn't working for you, probably something wrong with angular.json configuration, try follow the example bellow, it's really easy and it works!
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"cli6-sample": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
}
}
},
"defaultProject": "cli6-sample"
}
It works !!! and I found what my issue. I changed:
"schematics": {
"@schematics/angular": {
"component": {
"styleext": "scss"
}
}
To:
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
}
Both works with angular cli.
Big thank you!
It would be great to add support for global settings.
@mmercure , glad that it works. i'll add global settings support soon.
Yes but it only works with the Angular schematics. I tried the same with "@ngrx/schematics:component"
. Didn't work.
Before updating to angular 6, I had configuration in angular-cli.json for flat component and use scss. After updating my project. the angular-cli.json is changed to angular json, and defaults are now schemantics.
now if I generate a component, it does not use defaults, and generates css files, and component is not flat.