jetheredge / SquishIt

Lets you *easily* bundle some css and javascript! Check out the Google group if you have questions!
http://groups.google.com/group/squishit
MIT License
459 stars 119 forks source link

RenderCachedRawContent - does not work. Or I do not understand how to use it. #335

Open LarryBS opened 7 years ago

LarryBS commented 7 years ago
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;
        }

The method falls when trying to fetch the output from the dictionary which does not contain the key as yet. May be I use the method not correctly. Could you explain how to? Or there is a bug.

Thank you!

AlexCuse commented 7 years ago

Are you using "RenderCachedRawContent" to do your initial rendering? I'm guessing that is the problem, it is not terribly obvious.

I think you might be the first person to use this. @jkodroff needed it at some point but don't think he ever ended up using it.

LarryBS commented 7 years ago

Yes, guessed you'd answer this way. You see, I've got a task to realize this https://developers.google.com/speed/docs/insights/PrioritizeVisibleContent) In short, it requires that part of the CSS is loaded into the header directly. So in general the RenderRawContent suits me well, but not cached. So I tried the RenderCachedRawContent and it falls.

By all means thank you for your work!