-
Notifications
You must be signed in to change notification settings - Fork 920
Closed
Labels
Description
Adding all of our components to be able to render them server side would eventually get out of hand. There should be a way to wildcard and search subdirectories.
Example of the problem
public static class ReactConfig
{
public static void Configure()
{
ReactSiteConfiguration.Configuration
.AddScript("~/ClientApp/Components/Comments/Comment.jsx")
.AddScript("~/ClientApp/Components/Comments/CommentBox.jsx")
.AddScript("~/ClientApp/Components/Comments/CommentForm.jsx")
.AddScript("~/ClientApp/Components/Comments/CommentList.jsx");
// Additional component folders with endless amounts of component jsx files
}
}
However this seems to be done effectively with the BabelBundle package that implements IncludeDirectory in this example. If this format could be mimicked in ReactSiteConfiguration.Configuration it should solve the issue.
Proposed Solution
public static class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
// Searches components folder for all jsx files and all subdirectories for jsx files
bundles.Add(new BabelBundle("~/scripts/components")
.IncludeDirectory("~/ClientApp/Components", "*.jsx", true));
}
}
cal5barton and dustinsoftware