string GetFilesForRemote(IEnumerable <string> remoteAssetPaths, BundleState state) { var sb = new StringBuilder(); foreach (var uri in remoteAssetPaths) { sb.Append(FillTemplate(state, uri)); } return(sb.ToString()); }
public string RenderCached(string name) { bundleState = GetCachedBundleState(name); var content = CacheRenderer.Get(CachePrefix, name); if (content == null) { AsCached(name, bundleState.Path); return(CacheRenderer.Get(CachePrefix, name)); } return(content); }
string GetAdditionalAttributes(BundleState state) { var result = new StringBuilder(); foreach (var attribute in state.Attributes) { result.Append(attribute.Key); result.Append("=\""); result.Append(attribute.Value); result.Append("\" "); } return(result.ToString()); }
protected BundleBase(IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, IDebugStatusReader debugStatusReader, IDirectoryWrapper directoryWrapper, IHasher hasher, IBundleCache bundleCache) { this.fileWriterFactory = fileWriterFactory; this.fileReaderFactory = fileReaderFactory; this.debugStatusReader = debugStatusReader; this.directoryWrapper = directoryWrapper; this.hasher = hasher; bundleState = new BundleState { DebugPredicate = Configuration.Instance.DefaultDebugPredicate(), ShouldRenderOnlyIfOutputFileIsMissing = false, HashKeyName = "r" }; this.bundleCache = bundleCache; }
public string RenderNamed(string name) { bundleState = GetCachedBundleState(name); //TODO: this sucks // Revisit https://github.com/jetheredge/SquishIt/pull/155 and https://github.com/jetheredge/SquishIt/issues/183 //hopefully we can find a better way to satisfy both of these requirements var fullName = (BaseOutputHref ?? "") + CachePrefix + name; var content = bundleCache.GetContent(fullName); if (content == null) { AsNamed(name, bundleState.Path); return(bundleCache.GetContent(CachePrefix + name)); } return(content); }
/// <summary> /// Render cached 'raw' bundle content. /// </summary> /// <param name="bundleName">String representation of content according to cache.</param> /// <returns></returns> public string RenderCachedRawContent(string bundleName) { var cacheKey = CachePrefix + "_raw_" + bundleName; var output = rawContentCache.GetContent(cacheKey); if (output == null) { bundleState = rawContentBundleStateCache[cacheKey]; if (bundleState == null) { throw new InvalidOperationException(string.Format("No cached bundle state named {0} was found.", bundleName)); } output = RenderRawContent(bundleName); } return(output); }
public string RenderCachedAssetTag(string name) { bundleState = GetCachedBundleState(name); return(Render(null, name, new CacheRenderer(CachePrefix, name))); }
string FillTemplate(BundleState bundleState, string path) { return(string.Format(Template, GetAdditionalAttributes(bundleState), path)); }