From 908662dcfd4983ab62c1f20a724eeb762beb6061 Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Sat, 17 Jun 2017 23:03:03 +0200 Subject: [PATCH] In writeJSON (grunt), use CRLF on Windows --- tasks/lib/common.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks/lib/common.js b/tasks/lib/common.js index 31fb28e1823..d7c9ac12387 100644 --- a/tasks/lib/common.js +++ b/tasks/lib/common.js @@ -30,10 +30,6 @@ module.exports = function (grunt) { path = require("path"), _platform; - function writeJSON(grunt, path, obj) { - grunt.file.write(path, JSON.stringify(obj, null, " ")); - } - function resolve(relPath) { return path.resolve(process.cwd(), relPath); } @@ -51,6 +47,14 @@ module.exports = function (grunt) { return _platform; } + + function writeJSON(grunt, path, obj) { + var content = JSON.stringify(obj, null, " "); + if (platform() === "win") { + content = content.split("\n").join("\r\n"); + } + grunt.file.write(path, content); + } common.writeJSON = writeJSON; common.resolve = resolve;