public static void ShimBundle(this IModuleInitializer amd, BundleCollection bundles, string scriptPath)
 {
     var bundle = bundles.Get<ScriptBundle>(scriptPath);
     if (amd.Any(a => a.Path == scriptPath))
     {
         amd.Shim(scriptPath);
     }
     else
     {
         foreach (var asset in bundle.Assets)
         {
             amd.Shim(asset.Path);
         }
     }
 }
Пример #2
0
        public static void InitializeRequireJsModules(
            this BundleCollection bundles,
            string requireJsPath,
            Action <IModuleInitializer> configuration = null
            )
        {
            var amd = CreateAmdConfiguration();

            amd.InitializeModules(bundles, requireJsPath);
            if (configuration != null)
            {
                configuration(amd);
            }

            var mainBundle = bundles.Get <ScriptBundle>(amd.MainBundlePath);

            amd.AddRequireJsConfigAssetToMainBundle(mainBundle);

            // The config script will depended on the other bundles having been processed
            // so it can build URLs for them. We ensure the main bundle is processed last
            // by moving it to the end of the collection.
            MoveBundleToEnd(mainBundle, bundles);
        }
Пример #3
0
 public void ThenScriptBundleAddedToBundles()
 {
     bundles.Get <ScriptBundle>("cassette.web.jasmine").ShouldNotBeNull();
 }
Пример #4
0
        string MainScriptElements()
        {
            var bundle = bundles.Get <ScriptBundle>(configuration.MainBundlePath);

            return(bundle.Renderer.Render(bundle));
        }