Skip to content

Commit 71bcb14

Browse files
committed
AmCharts add ability to enable / disable source maps.
1 parent 454b693 commit 71bcb14

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/main/java/gwt/material/design/amcore/client/GwtMaterialAmCore.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
public class GwtMaterialAmCore implements EntryPoint {
3030

31+
private static boolean enableSourceMap = false;
32+
3133
@Override
3234
public void onModuleLoad() {
3335
// Inject Am4chart resources
@@ -45,10 +47,26 @@ protected static void directInjectJs(TextResource resource, boolean removeTag, b
4547
String text = resource.getText() + (sourceUrl ?
4648
"//# sourceURL=" + resource.getName() + ".js" : "");
4749

50+
if (!enableSourceMap) {
51+
String sourceMapImport = "//# sourceMappingURL=";
52+
if (text.contains(sourceMapImport)) {
53+
sourceMapImport = text.substring(text.indexOf(sourceMapImport), text.length());
54+
}
55+
text = text.replace(sourceMapImport, "");
56+
}
57+
4858
// Inject the script resource
4959
ScriptInjector.fromString(text)
5060
.setWindow(ScriptInjector.TOP_WINDOW)
5161
.setRemoveTag(removeTag)
5262
.inject();
5363
}
64+
65+
public static void setEnableSourceMap(boolean enableSourceMap) {
66+
GwtMaterialAmCore.enableSourceMap = enableSourceMap;
67+
}
68+
69+
public static boolean isEnableSourceMap() {
70+
return enableSourceMap;
71+
}
5472
}

0 commit comments

Comments
 (0)