1

When building a project, could be useful to force linux line endings to detect early problems in multi platform teams.

Forcing linux line endings in development all through out the a project sounds to me like a nice step forward like when I switched to utf-8 :)

Davor Hrg
  • 187
  • 1
  • 11

3 Answers3

1

If you are using git, you could let git solve it.

Otherwise, grunt-beautify has an option endOfLineCharacters. But that module seems dead.

asgoth
  • 35,552
  • 12
  • 89
  • 98
0

"grunt" pays attention to platform specific line feed.

You can force grunt to use on every platform the same line feed char. Do this at top of your grunt file:

// overwrite platform specific setting get always unix like line end
grunt.util.linefeed = '\n';

That option is documented here:

http://gruntjs.com/api/grunt.util#grunt.util.linefeed

TLindig
  • 48,010
  • 3
  • 28
  • 31
0

Use .editorconfig files

These make it really easy to set cross-platform line endings in a consistent manner across the team without the need for an additional build step. They are enforced any time you save a file.

Here's an example file which also uses spaces as tabs

# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
bevacqua
  • 47,502
  • 56
  • 171
  • 285