public Compile ( string content, string inputPath = null, string outputPath = null, |
||
content | string | Text content written on Sass |
inputPath | string | Path to input file |
outputPath | string | Path to output file |
options | Compilation options | |
return |
private void InnerTranslate(IAsset asset, SassCompiler sassCompiler, bool enableNativeMinification) { string assetTypeName = (asset.AssetTypeCode == Constants.AssetTypeCode.Sass) ? "Sass" : "SCSS"; string newContent; string assetUrl = asset.Url; IList<string> dependencies; CompilationOptions options = CreateCompilationOptions(asset.AssetTypeCode, enableNativeMinification); _fileManager.CurrentDirectoryName = UrlHelpers.GetDirectoryName(assetUrl); try { CompilationResult result = sassCompiler.Compile(asset.Content, assetUrl, options: options); newContent = result.CompiledContent; dependencies = result.IncludedFilePaths; } catch (FileNotFoundException) { throw; } catch (SassСompilationException e) { throw new AssetTranslationException( string.Format(CoreStrings.Translators_TranslationSyntaxError, assetTypeName, OUTPUT_CODE_TYPE, assetUrl, SassErrorHelpers.Format(e))); } catch (Exception e) { throw new AssetTranslationException( string.Format(CoreStrings.Translators_TranslationFailed, assetTypeName, OUTPUT_CODE_TYPE, assetUrl, e.Message), e); } finally { _fileManager.CurrentDirectoryName = null; } asset.Content = newContent; asset.Minified = enableNativeMinification; asset.RelativePathsResolved = false; asset.VirtualPathDependencies = dependencies; }