zer0
zer0

Reputation: 5017

Angular CLI command to skip creating the SCSS file

The following command in Angular CLI generates a new component with 3 files - HTML, TS and SCSS.

ng g c file --skip-import --spec false

I just need the HTML and CSS. I'm already skipping the spec file.. How do I tell it to skip creating the SCSS?

Upvotes: 3

Views: 8802

Answers (5)

RAHUL
RAHUL

Reputation: 1

To skip test and style files you can use following Angular command.

The Command:

ng g c topbar --skip-tests true --style none

Upvotes: 0

harryharryharry
harryharryharry

Reputation: 29

ng g c component-name --skip-tests --style none

for future reference: you can issue ng g c --help to show all options regarding generating components

(edit: I reread your question, if you want to force create css instead of scss, use --style css instead)

Upvotes: -1

Prakash Khadka
Prakash Khadka

Reputation: 173

Following angular command can be used in the terminal

ng g c something-component --flat -it -is --skipTests


     -is for inline css, preventing style file creation>
     --flat to prevent folder creation
     -it for inline template, preventing html file creation
     --skipTests to prevent .spec file creation

Try one of them as per your requirement

Upvotes: 9

You can also edit your angular-cli.json file to tell angular to create css file instead of scss

Open your angular-cli.json file from the root folder of your project.

Find the defaults key

...

"defaults": {
    "styleExt": "scss",
    "component": {}
}

...

and change the value of styleExt to css.

You should be good to go now.

Upvotes: 1

Yakov Fain
Yakov Fain

Reputation: 12378

You need the option inlne styles, e.g.

ng g c file -is -spec false

Upvotes: 7

Related Questions