Beispiel #1
0
    void CreateBundles(ScriptLocation location, TextWriter outputStream)
   {
      foreach (var subLocation in location.SubLocations)
      {
        CreateBundles(subLocation, outputStream);
      }

      var bundledScriptLines = location.BundledScripts;

      if (outputStream == null)
      {

        if(_transientDependencies)
        {
          bundledScriptLines = bundledScriptLines.Concat(location.TransientDependencyScripts); 
        }

        using (var bundleStream = new StreamWriter(location.BundleFilePath))
        {
          Console.WriteLine("\n======= Processing files to include in {0}", location.BundleFilePath);
          WriteBundle(bundleStream, bundledScriptLines);

          if(_includeSubFolders)
          {
            location.WriteSubFolderBundles(bundleStream);
          }

          Console.WriteLine(string.Format("Writing {0}", location.BundleFilePath));
        }
      }
      else
      {
        WriteBundle(outputStream, bundledScriptLines);
      }
    }
Beispiel #2
0
 public Bundler(ScriptLocation location, Options options)
 {
   _location = location;
   _rootOnly = options.RootOnly;
   _includeSubFolders = options.IncludeSubFolders;
   _transientDependencies = options.TransientDependencies;
   if(File.Exists(options.ExcludeFile))
   {
     ConfigureExclusions(options.ExcludeFile);
   }
 }