7

Note: This might look like a coding question, but it is not. It is about using developer tools.

When I use Angular Cli to generate components, services, directives etc. the files it produces all have Unix-style line-endings (LF), even when running in a windows environment.

What I am looking for is a way to get windows-style line-endings (CRLF) for the generated files. Something better than "open each file in an editor like npp or vscode, and select to change from LF to CRLF", because that is not how I want to spend my time.

A tslint rule is not sufficient because it doesn't fix html and css files.

I did find a workaround, using git: git stash save --include-untracked && git stash pop, but I still believe there are better ways...

Superole
  • 1,829

1 Answers1

1

I didn't find an answer to this issue, but I worked around the problem I was having (git shouting at me about newly generated files with LF endings) by setting core.safecrlf=warn (was previously core.safecrlf=true) which, in conjunction with core.autocrlf=true, meant that even though Angular CLI generated files with LF endings, when staging the files they were converted to CRLF (with a warning) which achieved what I needed to be achieved.