private static void BundleModule(string moduleDir) { // take bundle.json string bundleInfoJson = File.ReadAllText(Path.Combine(moduleDir, "module.json")); ModuleBundle bundleInfo = JsonConvert.DeserializeObject <ModuleBundle>(bundleInfoJson); if (bundleInfo != null) { if (bundleInfo.Scripts != null && bundleInfo.Scripts.Length > 0) { BundleModuleScripts(moduleDir, bundleInfo); } } }
private static void BundleModuleScripts(string moduleDir, ModuleBundle bundleInfo) { string bundlePath = Path.Combine(moduleDir, "module.min.js"); // create bundle var bundle = Bundle.JavaScript().ForceRelease(); // add each script to bundle foreach (var script in bundleInfo.Scripts) { bundle.Add(Path.Combine(moduleDir, script + ".js")); } // render bundle to disk in current module folder bundle.Render(bundlePath); }