Skip to content

Commit 522ad76

Browse files
Implicitly add "/** @jsx React.DOM */" when using JSXBundle.
Use the same ConcatenationToken as used in the ScriptBundle class.
1 parent 558dd49 commit 522ad76

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/System.Web.Optimization.React/JsxBundle.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,25 @@ public class JsxBundle : Bundle
2323
/// </param>
2424
public JsxBundle(string virtualPath) : base(virtualPath, GetTransforms())
2525
{
26+
base.ConcatenationToken = ";" + Environment.NewLine;
2627
}
2728

29+
/// <summary>
30+
/// Applies the transformations.
31+
/// </summary>
32+
/// <returns>The bundle response.</returns>
33+
public override BundleResponse ApplyTransforms(BundleContext context, string bundleContent, Collections.Generic.IEnumerable<BundleFile> bundleFiles)
34+
{
35+
const string pragma = "/** @jsx React.DOM */";
36+
37+
if (!bundleContent.TrimStart().StartsWith(pragma))
38+
{
39+
bundleContent = pragma + bundleContent;
40+
}
41+
42+
return base.ApplyTransforms(context, bundleContent, bundleFiles);
43+
}
44+
2845
/// <summary>
2946
/// Gets the transformations that should be used by the bundle.
3047
/// </summary>

0 commit comments

Comments
 (0)