Last active
September 30, 2015 01:41
-
-
Save lydonchandra/b97b38e3ff56ba8e0ba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM --source_map_location_mapping is case SENSITIVE ! | |
REM need extra escaped double quote --source_map_location_mapping="\"C:/tools/closure/^|http://bla/\"" as per http://stackoverflow.com/a/29542669 | |
java -jar compiler.jar --compilation_level=SIMPLE_OPTIMIZATIONS --create_source_map=C:\tools\closure\latest\maplayer.js.map --output_wrapper "%output%//# sourceMappingURL=maplayer.js.map" --js=C:\tools\closure\mapslayer.js --js_output_file=maplayer.min.js --source_map_location_mapping="\"C:/tools/closure/^|http://bla/\"" |
Only found this out after reading SourceMap.java (in closure compiler source code)
(https://github.com/google/closure-compiler/blob/v20150609/src/com/google/javascript/jscomp/SourceMap.java#L140)
private String fixupSourceLocation(String sourceFile) {
// Replace backslashes (the file separator used on Windows systems).
if (File.separatorChar == '\\') {
sourceFile = sourceFile.replace('\\', '/');
}
if (prefixMappings.isEmpty()) {
return sourceFile;
}
String fixed = sourceLocationFixupCache.get(sourceFile);
if (fixed != null) {
return fixed;
}
// Replace the first prefix found with its replacement
for (LocationMapping mapping : prefixMappings) {
if (sourceFile.startsWith(mapping.prefix)) {
fixed = mapping.replacement + sourceFile.substring(
mapping.prefix.length());
break;
}
}
// If none of the mappings match then use the original file path.
if (fixed == null) {
fixed = sourceFile;
}
sourceLocationFixupCache.put(sourceFile, fixed);
return fixed;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--source_map_location_mapping=""C:/tools/closure/^|http://bla/\"" needs extra and espaced double quote "