Once in a while, I need to develop something using Windows laptop, and that always causes end of the line problems. Here is how to prevent them once and for all.
Make sure your editor uses Unix line endings. For example, in Sublime
you can set user preference "default_line_ending": "unix"
Turn off Git line ending conversion to system's native one
git config --global core.autocrlf false
Tell Git that LF
(unix) should be the default one
git config --global core.eol lf
Install grunt-lineending plugin.
npm install grunt-lineending --save-dev
The line endings mostly affect the first file used for Node command line
tools with shebang line #!/usr/bin/env node
, usually I only
convert only line endings in this file. Here is typical grunt
configuration
1 | lineending: { |
Examples: next-update, gt