public void Process(ProcessingContext context, OutputHelper output)
		{
			var bundle = context.Bundle;

			if (context.HostingEnvironment.IsDevelopment())
			{
				foreach (var f in bundle.Src)
				{
					Generate(f, output);
				}
			}
			else
			{
				Generate(context.FileVersionProvider.AddFileVersionToPath(
					$"/{bundle.Dest}/{bundle.Name}{Extension}"), output);
			}
		}
Exemplo n.º 2
0
		private List<Element> Process(string sectionName, string bundleName, IProcessor processor)
		{
			var deps = LoadDeps();
			var section = deps[sectionName] as IList<dynamic>;
			if (section == null)
			{
				throw new InvalidOperationException($"The section {sectionName} doesn't exist.");
			}

			var bundle = section
				.FirstOrDefault(b => string.Equals(bundleName, b.name, StringComparison.OrdinalIgnoreCase));

			if (bundle == null)
			{
				throw new InvalidOperationException($"The bundle {bundleName} doesn't exist.");
			}

			NormalizeBundle(bundle);
			var strongBundle = ExtractBundle(bundle);

			var output = new OutputHelper();
			var context = new ProcessingContext()
			{
				Bundle = strongBundle,
				Original = bundle,
				HostingEnvironment = _env,
				FileProvider = _env.WebRootFileProvider,
				FileVersionProvider = _fileVersionProvider,
			};

			processor.Process(context, output);

			return output.Elements;
		}