{"id":13431138,"url":"https://github.com/Taritsyn/LibSassHost","last_synced_at":"2025-03-16T06:32:29.097Z","repository":{"id":60773163,"uuid":"44171750","full_name":"Taritsyn/LibSassHost","owner":"Taritsyn","description":".NET wrapper around the LibSass library with the ability to support a virtual file system.","archived":false,"fork":false,"pushed_at":"2025-02-19T14:15:37.000Z","size":51071,"stargazers_count":86,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-09T16:38:25.729Z","etag":null,"topics":["css","dotnet","libsass","sass","scss"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Taritsyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-13T11:30:23.000Z","updated_at":"2025-02-19T14:15:42.000Z","dependencies_parsed_at":"2024-01-05T20:51:58.071Z","dependency_job_id":"2d4d503b-32df-427b-a359-7dd91061db76","html_url":"https://github.com/Taritsyn/LibSassHost","commit_stats":{"total_commits":232,"total_committers":3,"mean_commits":77.33333333333333,"dds":0.008620689655172376,"last_synced_commit":"7fa075981f3621289f33bb6176659c38af7a060a"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taritsyn%2FLibSassHost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taritsyn%2FLibSassHost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taritsyn%2FLibSassHost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taritsyn%2FLibSassHost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taritsyn","download_url":"https://codeload.github.com/Taritsyn/LibSassHost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835952,"owners_count":20355611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","dotnet","libsass","sass","scss"],"created_at":"2024-07-31T02:01:00.794Z","updated_at":"2025-03-16T06:32:29.091Z","avatar_url":"https://github.com/Taritsyn.png","language":"C++","funding_links":[],"categories":["Frameworks, Libraries and Tools","框架, 库和工具","HTML and CSS"],"sub_categories":["Misc","大杂烩","GUI - other"],"readme":"LibSass Host for .NET [![NuGet version](https://img.shields.io/nuget/v/LibSassHost.svg)](https://www.nuget.org/packages/LibSassHost/)  [![Download count](https://img.shields.io/nuget/dt/LibSassHost.svg)](https://www.nuget.org/packages/LibSassHost/)\n=====================\n\n\u003cimg src=\"https://raw.githubusercontent.com/Taritsyn/LibSassHost/master/images/LibSassHost_Logo.png\" width=\"360\" height=\"100\" alt=\"LibSass Host logo\" /\u003e\n\n.NET wrapper around the [LibSass](https://github.com/sass/libsass) library with the ability to support a virtual file system.\n\n## Installation\nThis library can be installed through NuGet.\n[LibSassHost](https://www.nuget.org/packages/LibSassHost/) package does not contain the native implementations of the LibSass.\nTherefore, you need to choose and install the most appropriate package(s) for your platform.\nThe following packages are available:\n\n * [LibSassHost.Native.win-x86](https://www.nuget.org/packages/LibSassHost.Native.win-x86/) contains the native assembly for Windows (x86).\n * [LibSassHost.Native.win-x64](https://www.nuget.org/packages/LibSassHost.Native.win-x64/) contains the native assembly for Windows (x64).\n * [LibSassHost.Native.win-arm](https://www.nuget.org/packages/LibSassHost.Native.win-arm/) contains the native assembly for Windows (ARM).\n * [LibSassHost.Native.win-arm64](https://www.nuget.org/packages/LibSassHost.Native.win-arm64/) contains the native assembly for Windows (ARM64).\n * [LibSassHost.Native.linux-x64](https://www.nuget.org/packages/LibSassHost.Native.linux-x64/) contains the native assembly for Linux (x64). Only compatible with .NET Core.\n * [LibSassHost.Native.osx-x64](https://www.nuget.org/packages/LibSassHost.Native.osx-x64/) contains the native assembly for OS X (x64). Only compatible with .NET Core.\n\nIf you need support for other operating systems, then you should read the [“Building LibSass”](#building-libsass) section.\n\n### Mono support\n\nLibSassHost.Native.linux-x64 and LibSassHost.Native.osx-x64 packages do not support installation under [Mono](http://www.mono-project.com/), but you can to install the native assemblies manually.\n\n#### Linux\n\nFirst you need to get the `libsass.so` assembly file. You have 3 ways to do this:\n\n 1. [Download a assembly file](https://github.com/Taritsyn/LibSassHost/blob/master/lib/linux-x64/libsass.so) from the LibSass Host's project repository.\n 1. Extract a assembly file from the [LibSassHost.Native.linux-x64](https://www.nuget.org/packages/LibSassHost.Native.linux-x64/) package. The `libsass.so` file is located in the `runtimes/linux-x64/native/` directory of NuGet package.\n 1. [Build a assembly file](#building-libsass) from the source code.\n\nAfterwards open a terminal window and change directory to the directory where the `libsass.so` file is located. Next, enter the following command:\n\n```\nsudo cp libsass.so /usr/local/lib/\nsudo ldconfig\n```\n\n#### OS X\n\nFirst you need to get the `libsass.dylib` assembly file. You have 3 ways to do this:\n\n 1. [Download a assembly file](https://github.com/Taritsyn/LibSassHost/blob/master/lib/osx-x64/libsass.dylib) from the LibSass Host's project repository.\n 1. Extract a assembly file from the [LibSassHost.Native.osx-x64](https://www.nuget.org/packages/LibSassHost.Native.osx-x64/) package. The `libsass.dylib` file is located in the `runtimes/osx-x64/native/` directory of NuGet package.\n 1. [Build a assembly file](#building-libsass) from the source code.\n\nAfterwards open a terminal window and change directory to the directory where the `libsass.dylib` file is located. Next, enter the following command:\n\n```\nmkdir -p /usr/local/lib/ \u0026\u0026 cp libsass.dylib \"$_\"\n```\n\n## Usage\nThe main difference between this library from other .NET wrappers around the LibSass (e.g. [libsassnet](https://github.com/darrenkopp/libsass-net/), [SharpScss](https://github.com/xoofx/SharpScss), [NSass](https://github.com/TBAPI-0KA/NSass), [Sass.Net](https://www.nuget.org/packages/XWeb.Web.Sass.Core)) is ability to support a virtual file system. You can set the file manager by using `FileManager` property of the \u003ccode title=\"LibSassHost.SassCompiler\"\u003eSassCompiler\u003c/code\u003e class:\n\n```csharp\nSassCompiler.FileManager = CustomFileManager();\n```\n\nAny class, that implements an \u003ccode title=\"LibSassHost.IFileManager\"\u003eIFileManager\u003c/code\u003e interface, can be used as a file manager.\nBy default, file manager is not specified, and for access to the file system are used built-in tools of the LibSass library.\nThe main advantage of using built-in tools is the low memory consumption.\nBut there is a disadvantage: there is no ability to process files in UTF-16 encoding.\n\nTo resolve this disadvantage you need to use the \u003ccode title=\"LibSassHost.FileManager\"\u003eFileManager\u003c/code\u003e class:\n\n```csharp\nSassCompiler.FileManager = FileManager.Instance;\n```\n\nBut in this case, will increase memory consumption (approximately 3 times).\n\nA good example of implementing a custom file manager, which provides access to the virtual file system, is the \u003ca href=\"https://github.com/Taritsyn/BundleTransformer/blob/5ee76a16f30d29fd54e7864fb8a10cfeb5b91e92/src/BundleTransformer.SassAndScss/Internal/VirtualFileManager.cs\" target=\"_blank\"\u003e\u003ccode title=\"BundleTransformer.SassAndScss.Internal.VirtualFileManager\"\u003eVirtualFileManager\u003c/code\u003e\u003c/a\u003e class from the \u003ca href=\"https://www.nuget.org/packages/BundleTransformer.SassAndScss/1.12.36\" target=\"_blank\"\u003eBundleTransformer.SassAndScss\u003c/a\u003e package.\n\nIt should also be noted, that this library does not write the result of compilation to disk. `Compile` and `CompileFile` methods of the \u003ccode title=\"LibSassHost.SassCompiler\"\u003eSassCompiler\u003c/code\u003e class return the result of compilation in the form of an instance of the \u003ccode title=\"LibSassHost.CompilationResult\"\u003eCompilationResult\u003c/code\u003e class. Consider in detail properties of the \u003ccode title=\"LibSassHost.CompilationResult\"\u003eCompilationResult\u003c/code\u003e class:\n\n\u003ctable border=\"1\" style=\"font-size: 0.7em\"\u003e\n    \u003cthead\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003cth\u003eProperty name\u003c/th\u003e\n            \u003cth\u003eData\u0026nbsp;type\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eCompiledContent\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.String\"\u003eString\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eCSS code.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eIncludedFilePaths\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Collections.Generic.IList\u0026lt;string\u0026gt;\"\u003eIList\u0026lt;string\u0026gt;\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eList of included files.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceMap\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.String\"\u003eString\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eSource map.\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\nConsider a simple example of usage of the `Compile` method:\n\n```csharp\nusing System;\n\nusing LibSassHost;\nusing LibSassHost.Helpers;\n\nnamespace LibSassHost.Example.ConsoleApplication\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            const string inputContent = @\"$font-stack:    Helvetica, sans-serif;\n$primary-color: #333;\n\nbody {\n  font: 100% $font-stack;\n  color: $primary-color;\n}\";\n\n            try\n            {\n                var options = new CompilationOptions { SourceMap = true };\n                CompilationResult result = SassCompiler.Compile(inputContent, \"input.scss\", \"output.css\",\n                    \"output.css.map\", options);\n\n                Console.WriteLine(\"Compiled content:{1}{1}{0}{1}\", result.CompiledContent,\n                    Environment.NewLine);\n                Console.WriteLine(\"Source map:{1}{1}{0}{1}\", result.SourceMap, Environment.NewLine);\n                Console.WriteLine(\"Included file paths: {0}\",\n                    string.Join(\", \", result.IncludedFilePaths));\n            }\n            catch (SassCompilationException e)\n            {\n                Console.WriteLine(\"During compilation of SCSS code an error occurred. See details:\");\n                Console.WriteLine();\n                Console.WriteLine(SassErrorHelpers.GenerateErrorDetails(e));\n            }\n        }\n    }\n}\n```\n\nFirst we call the `Compile` method of \u003ccode title=\"LibSassHost.SassCompiler\"\u003eSassCompiler\u003c/code\u003e class with the following parameters:\n\n 1. `content` - text content written on Sass/SCSS.\n 1. `inputPath` - path to input Sass/SCSS file. Needed for generation of source map.\n 1. `outputPath` (optional) - path to output CSS file. Needed for generation of source map. If path to output file is not specified, but specified a path to input file, then value of this parameter is obtained by replacing extension in the input file path by `.css` extension.\n 1. `sourceMapPath` (optional) - path to source map file. If path to source map file is not specified, but specified a path to output file, then value of this parameter is obtained by replacing extension in the output file path by `.css.map` extension.\n 1. `options` (optional) - compilation options (instance of the \u003ccode title=\"LibSassHost.CompilationOptions\"\u003eCompilationOptions\u003c/code\u003e class)\n\nThen output result of compilation to the console. In addition, we provide handling of the \u003ccode title=\"LibSassHost.SassCompilationException\"\u003eSassCompilationException\u003c/code\u003e exception.\n\nAnd now let's consider in detail properties of the \u003ccode title=\"LibSassHost.CompilationOptions\"\u003eCompilationOptions\u003c/code\u003e class:\n\n\u003ctable border=\"1\" style=\"font-size: 0.7em\"\u003e\n    \u003cthead\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003cth\u003eProperty name\u003c/th\u003e\n            \u003cth\u003eData\u0026nbsp;type\u003c/th\u003e\n            \u003cth\u003eDefault value\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eAdditionalImportExtensions\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Collections.Generic.IList\u0026lt;string\u0026gt;\"\u003eIList\u0026lt;string\u0026gt;\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003e.css\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eList of additional \u003ccode\u003e@import\u003c/code\u003e file extensions.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eIncludePaths\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Collections.Generic.IList\u0026lt;string\u0026gt;\"\u003eIList\u0026lt;string\u0026gt;\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eEmpty list\u003c/td\u003e\n            \u003ctd\u003eList of include paths.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eIndentType\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"LibSassHost.IndentType\"\u003eIndentType\u003c/code\u003e enumeration\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eSpace\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eIndent type. Can take the following values:\n                \u003cul\u003e\n                    \u003cli\u003e\u003ccode\u003eSpace\u003c/code\u003e - space character\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eTab\u003c/code\u003e - tab character\u003c/li\u003e\n                \u003c/ul\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eIndentWidth\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Int32\"\u003eInt32\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003e2\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eNumber of spaces or tabs to be used for indentation.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eInlineSourceMap\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to embed \u003ccode\u003esourceMappingUrl\u003c/code\u003e as data uri.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eLineFeedType\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"LibSassHost.LineFeedType\"\u003eLineFeedType\u003c/code\u003e enumeration\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eLf\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eLine feed type. Can take the following values:\n                \u003cul\u003e\n                    \u003cli\u003e\u003ccode\u003eCr\u003c/code\u003e - Macintosh (CR)\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eCrLf\u003c/code\u003e - Windows (CR LF)\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eLf\u003c/code\u003e - Unix (LF)\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eLfCr\u003c/code\u003e\u003c/li\u003e\n                \u003c/ul\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eOmitSourceMapUrl\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to disable \u003ccode\u003esourceMappingUrl\u003c/code\u003e in css output.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eOutputStyle\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"LibSassHost.OutputStyle\"\u003eOutputStyle\u003c/code\u003e enumeration\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eNested\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eOutput style for the generated css code. Can take the following values:\n                \u003cul\u003e\n                    \u003cli\u003e\u003ccode\u003eNested\u003c/code\u003e\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eExpanded\u003c/code\u003e\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eCompact\u003c/code\u003e\u003c/li\u003e\n                    \u003cli\u003e\u003ccode\u003eCompressed\u003c/code\u003e\u003c/li\u003e\n                \u003c/ul\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003ePrecision\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Int32\"\u003eInt32\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003e5\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003ePrecision for fractional numbers.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceComments\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to emit comments in the generated CSS indicating the corresponding source line.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceMap\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to enable source map generation.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceMapFileUrls\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to create file urls for sources.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceMapIncludeContents\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.Boolean\"\u003eBoolean\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eFlag for whether to include contents in maps.\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd\u003e\u003ccode\u003eSourceMapRootPath\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode title=\"System.String\"\u003eString\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003eEmpty string\u003c/td\u003e\n            \u003ctd\u003eValue will be emitted as \u003ccode\u003esourceRoot\u003c/code\u003e in the source map information.\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\nUsing of the `CompileFile` method quite a bit different from using of the `Compile` method:\n\n```csharp\nusing System;\nusing System.IO;\n\nusing LibSassHost;\nusing LibSassHost.Helpers;\n\nnamespace LibSassHost.Example.ConsoleApplication\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            const string basePath = \"/Projects/TestSass\";\n            string inputFilePath = Path.Combine(basePath, \"style.scss\");\n            string outputFilePath = Path.Combine(basePath, \"style.css\");\n            string sourceMapFilePath = Path.Combine(basePath, \"style.css.map\");\n\n            try\n            {\n                var options = new CompilationOptions { SourceMap = true };\n                CompilationResult result = SassCompiler.CompileFile(inputFilePath, outputFilePath,\n                    sourceMapFilePath, options);\n\n                Console.WriteLine(\"Compiled content:{1}{1}{0}{1}\", result.CompiledContent,\n                    Environment.NewLine);\n                Console.WriteLine(\"Source map:{1}{1}{0}{1}\", result.SourceMap, Environment.NewLine);\n                Console.WriteLine(\"Included file paths: {0}\",\n                    string.Join(\", \", result.IncludedFilePaths));\n            }\n            catch (SassCompilationException e)\n            {\n                Console.WriteLine(\"During compilation of SCSS file an error occurred. See details:\");\n                Console.WriteLine();\n                Console.WriteLine(SassErrorHelpers.GenerateErrorDetails(e));\n            }\n        }\n    }\n}\n```\n\nIn this case, the `inputPath` parameter is used instead of the `content` parameter. Moreover, value of the `inputPath` parameter now should contain the path to real file.\n\n## Building LibSass\nLibSassHost uses a modified version of the LibSass library.\nIn most cases, you do not need to build the LibSass from source code, because the native assemblies is published as `LibSassHost.Native.*` NuGet packages.\nThe only exception is the case, when you want to build library for a specific Linux distro.\n\nTo build a modified version of the LibSass you must first clone the LibSassHost repository:\n\n```\nmkdir Github \u0026\u0026 cd Github\ngit clone https://github.com/Taritsyn/LibSassHost.git\n```\n\nFurther actions depend on your operating system.\n\n### Windows\nIn your system must be installed Visual Studio 2019 or 2022 with C++ support.\n\nTo build the LibSass on Windows:\n\n 1. Open `libsass.sln` in Visual Studio.\n 1. Select the **Configuration** and target **Platform**, and build the solution.\n 1. Build output will be under `src\\libsass\\bin\\[Debug|Release]\\[Win32|x64]`.\n\nAlternatively, you can use the build script.\nOpen a Visual Studio developer command prompt and run the `build-libsass.cmd` script from your `LibSassHost` project directory:\n\n```\nC:\\Users\\username\\Github\\LibSassHost\u003e build-libsass\n```\n\nBuild script can also take a options, information about which can be obtained by using the following command:\n\n```\nbuild-libsass /?\n```\n\n### Linux\nIn your system must be installed GCC (GNU Compiler Collection).\nIn every Linux distro installation of GCC is made in different ways.\nFor example, in Ubuntu 16.04 this is done as follows:\n\n```\nsudo apt-get update\nsudo apt-get install build-essential\n```\n\nTo build the LibSass on Linux open a terminal window and run the `build-libsass.sh` script from your `LibSassHost` project directory:\n\n```\nusername@ubuntu-16:~/Github/LibSassHost$ ./build-libsass.sh\n```\n\nBuild output will be under `src/libsass/bin/[Debug|Release]/Linux`.\n\nBuild script can also take a options, information about which can be obtained by using the following command:\n\n```\n./build-libsass.sh --help\n```\n\n### OS X\nIn your system must be installed Xcode Command Line Tools.\nTo install Xcode Command Line Tools, in your terminal simply run:\n\n```\nxcode-select --install\n```\n\nTo build the LibSass on OS X open a terminal window and run the `build-libsass.sh` script from your `LibSassHost` project directory:\n\n```\nMy-Mac:LibSassHost username$ ./build-libsass.sh\n```\n\nBuild output will be under `src/libsass/bin/[Debug|Release]/OSX`.\n\nBuild script can also take a options, information about which can be obtained by using the following command:\n\n```\n./build-libsass.sh --help\n```\n\n## Who's Using LibSass Host for .NET\nIf you use the LibSass Host for .NET in some project, please send me a message so I can include it in this list:\n\n * [Abstractions Sass Compiler CI Build](https://www.nuget.org/packages/Abstractions.Sass.CIBuild) by Abstractions AS\n * [Abstractions Sass Compiler Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AbstractionsAS.AbstractionsSassVisualStudioExtension) by Abstractions AS\n * [Abstractions SASS Theming System](https://www.nuget.org/packages/Abstractions.Sass.Theming/) by Abstractions AS\n * [Core Sass Compiler](https://github.com/benwmills/core-sass-compiler) by Ben Mills\n * [CssBuilder](https://github.com/x-projs/CssBuilder)\n * [JacobDixon.AspNetCore.LiveSassCompile](https://github.com/JakeDixon/JacobDixon.AspNetCore.LiveSassCompile) by Jacob Dixon\n * [Karambolo.AspNetCore.Bundling](https://github.com/adams85/bundling) by Adam Simon\n * [LibSassBuilder](https://github.com/johan-v-r/LibSassBuilder) by Johan van Rensburg\n * [MustardBlack-Core.Assets.Css.Sass](https://www.nuget.org/packages/MustardBlack-Core.Assets.Css.Sass/) by Andrew Bullock\n * [Profound.Kentico.SassPlugin](https://www.nuget.org/packages/Profound.Kentico.SassPlugin/) by Arindam Debnath\n * [Sass.AspNetCore](https://www.nuget.org/packages/Sass.AspNetCore/) by Aleksandr Ovchinnikov\n * [Virto Commerce Storefront Kit](https://github.com/VirtoCommerce/vc-storefront) by Virto Solutions LTD","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaritsyn%2FLibSassHost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTaritsyn%2FLibSassHost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaritsyn%2FLibSassHost/lists"}