public override void Process(BundleResponse bundle)
        {
            var compiler = new CoffeeScriptEngine();
            bundle.Content = compiler.Compile(bundle.Content);

            base.Process(bundle);
        }
예제 #2
0
    public override void Process(BundleResponse bundle)
    {
        var compiler = new CoffeeScriptEngine();

        bundle.Content = compiler.Compile(bundle.Content);

        base.Process(bundle);
    }
예제 #3
0
        public void Process(BundleContext context, BundleResponse response)
        {
            var coffeeScriptEngine   = new CoffeeScriptEngine();
            var compiledCoffeeScript = new StringBuilder();

            foreach (var file in response.Files)
            {
                using (var reader = new StreamReader(file.FullName)) {
                    compiledCoffeeScript.Append(coffeeScriptEngine.Compile(reader.ReadToEnd()));
                    reader.Close();
                }
            }
            response.Content      = compiledCoffeeScript.ToString();
            response.ContentType  = "text/javascript";
            response.Cacheability = HttpCacheability.Public;
        }
        public string Compile(string file)
        {
            if (Accept(file))
            {
                if (!File.Exists(file))
                {
                    throw new Exception("attempt to compile a nonexistent file.");
                }

                using (var reader = new StreamReader(file))
                {
                    return(CoffeeScriptEngine.Compile(reader.ReadToEnd()));
                }
            }
            throw new Exception("attempt to compile an invalid file.");
        }
예제 #5
0
        public void Process(BundleContext context, BundleResponse response)
        {
            var coffeeEngine = new CoffeeScriptEngine();
            var compiledCoffeeScript = string.Empty;
            foreach (var file in response.Files)
            {
                using (var sr = new StreamReader(file.FullName))
                {
                    compiledCoffeeScript += coffeeEngine.Compile(sr.ReadToEnd());
                    sr.Close();
                }
            }

            response.Content = compiledCoffeeScript;
            response.ContentType = "text/javascript";
            response.Cacheability = HttpCacheability.Public;
        }
예제 #6
0
        public void Process(BundleContext context, BundleResponse response)
        {
            response.ContentType = "text/javascript";
            response.Content     = string.Empty;

            foreach (var fileInfo in response.Files)
            {
                if (fileInfo.Extension.Equals(".coffee", StringComparison.Ordinal))
                {
                    response.Content += TransformCache.Get(fileInfo, () => _Engine.Compile(File.ReadAllText(fileInfo.FullName)));
                }
                else if (fileInfo.Extension.Equals(".js", StringComparison.Ordinal))
                {
                    response.Content += TransformCache.Get(fileInfo, () => File.ReadAllText(fileInfo.FullName));
                }
            }
        }
예제 #7
0
        public void Process(BundleContext context, BundleResponse response)
        {
            var coffeeEngine         = new CoffeeScriptEngine();
            var compiledCoffeeScript = string.Empty;

            foreach (var file in response.Files)
            {
                using (var sr = new StreamReader(file.FullName))
                {
                    compiledCoffeeScript += coffeeEngine.Compile(sr.ReadToEnd());
                    sr.Close();
                }
            }

            response.Content      = compiledCoffeeScript;
            response.ContentType  = "text/javascript";
            response.Cacheability = HttpCacheability.Public;
        }
예제 #8
0
 public static string Compile(string code)
 {
     return(CoffeeScriptEngine.Compile(code));
 }