From 0ccab0463c56f9515848124e1b5f75e17d83f438 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 13 Oct 2012 17:25:35 +0400 Subject: [PATCH] make generated file a little smaller --- Makefile.dryice.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 4f525c39..3109f84f 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -251,9 +251,9 @@ function addSuffix(options) { function getWriteFilters(options, projectType) { var filters = [ copy.filter.moduleDefines, - inlineTextModules, removeUseStrict, - removeLicenceComments + removeLicenceComments, + inlineTextModules ]; if (options.filters) @@ -465,7 +465,8 @@ var detectTextModules = function(input, source) { var module = source.isLocation ? source.path : source; input = input.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); - input = '"' + input.replace(/\n/g, '\\n\\\n') + '"'; + input = input.replace(/\n\s+/g, "\n"); + input = '"' + input.replace(/\n/g, '\\\n') + '"'; textModules[module] = input; return ""; @@ -543,7 +544,7 @@ function removeUseStrict(text) { } function removeLicenceComments(text) { - return text.replace(/(;)\s*\/\*[\d\D]*?\*\//g, "$1"); + return text.replace(/(?:(;)|\n)\s*\/\*[\d\D]*?\*\/|\n\s*\/\/.*/g, "$1"); } function namespace(ns) {