Skip to content

Commit

Permalink
fix #2351 Minification fails on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Feb 12, 2015
1 parent 388f023 commit 0b20e4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile.dryice.js
Expand Up @@ -307,6 +307,7 @@ function buildAceModuleInternal(opts, callback) {
ignore: opts.ignore || [],
withRequire: false,
basepath: ACE_HOME,
transforms: [normalizeLineEndings],
afterRead: [optimizeTextModules]
}, write);
}
Expand Down Expand Up @@ -407,6 +408,10 @@ function getLoadedFileList(options, callback, result) {
callback(Object.keys(deps));
}

function normalizeLineEndings(module) {
module.source = module.source.replace(/\r\n/g, "\n");
}

function optimizeTextModules(sources) {
var textModules = {};
return sources.filter(function(pkg) {
Expand Down Expand Up @@ -452,10 +457,10 @@ function optimizeTextModules(sources) {
if (/\.css$/.test(pkg.id)) {
// remove unnecessary whitespace from css
input = input.replace(/\n\s+/g, "\n");
input = '"' + input.replace(/\r?\n/g, '\\\n') + '"';
input = '"' + input.replace(/\n/g, '\\\n') + '"';
} else {
// but don't break other files!
input = '"' + input.replace(/\r?\n/g, '\\n\\\n') + '"';
input = '"' + input.replace(/\n/g, '\\n\\\n') + '"';
}
textModules[pkg.id] = input;
}
Expand Down

0 comments on commit 0b20e4d

Please sign in to comment.