public void SaveTranslation(string path)
        {
            IAsset file = new Asset(path);
            SassAndScssTranslator translator = new SassAndScssTranslator();
            var compiled = translator.Translate(file);

            var normalCSS = path.Replace("." + FileExtension, ".css");

            using (var compiledCSS = File.CreateText(HostingEnvironment.MapPath(normalCSS)))
            {
                compiledCSS.Write(compiled.Content);
                compiledCSS.Close();
            }
        }
        public IEnumerable<Exception> ValidateTranslation(string path)
        {
            var retVal = new List<Exception>();
            try
            {
                IAsset file = new Asset(path);
                SassAndScssTranslator translator = new SassAndScssTranslator();
                translator.Translate(file);
            }
            catch (AssetTranslationException ex)
            {
                retVal.Add(ex);
            }

            return retVal;
        }
예제 #3
0
        private static CssTransformer CreateCssTransformer()
        {
            ITranslator scssTranslator = new SassAndScssTranslator();
            var transformer = new CssTransformer(new[] {scssTranslator});

            return transformer;
        }