Example #1
0
        private string GetOrAddCompiledToCache(string content, string path, bool coffeeScriptBareMode)
        {
            var key    = string.Format("coffeeScriptBareMode:{0},Source:{1}", coffeeScriptBareMode, content);
            var cached = compilerCache.Get(key);

            if (string.IsNullOrEmpty(cached))
            {
                try
                {
                    cached = coffeeScriptEngine.Compile(content, coffeeScriptBareMode);
                }
                catch (ChutzpahCompilationFailedException ex)
                {
                    ex.SourceFile = path;
                    throw;
                }
                compilerCache.Set(key, cached);
            }

            return(cached);
        }