Sass2JSON 0.1.0

dotnet add package Sass2JSON --version 0.1.0
NuGet\Install-Package Sass2JSON -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sass2JSON" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sass2JSON --version 0.1.0
#r "nuget: Sass2JSON, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sass2JSON as a Cake Addin
#addin nuget:?package=Sass2JSON&version=0.1.0

// Install Sass2JSON as a Cake Tool
#tool nuget:?package=Sass2JSON&version=0.1.0

Sass2JSON

Converts Sass variables to a corresponding JSON format.

Currently Supports

  • Variables
  • Maps
  • Custom output object format

Output Format

The converter will take your isolated Sass variable file and convert it to a list of objects in the format below. This list will then be convertered into your final JSON data structure.

public class SassDocItem
{
    public string Class { get; set; }
    public string Variable { get; set; }
    public object Value { get; set; }
    public string SaSSType { get; set; }
}

Example

Provided is a basic example of sass variables and a sass map and the expected JSON output if run through the converter.

Sass Input
// @json-config-default AutoGenHelper=true

// Basic variable examples
$color-red: #DC3545
$color-orange: #FF9800
$color-yellow: #FFEB3B
$color-green: #28A745
$color-blue: #2D578F

// Map example
$other-color-map: ( white: $color-white, black: $color-black, light: $color-light, dark: $color-dark, success: $color-success, danger: $color-danger, warning: $color-warning, divider: $color-divider, link: $color-link );
JSON Output
[
    {
        "class": null,
        "variable": "$color-red",
        "value": "#DC3545",
        "sassType": "value"
    },
    {
        "class": null,
        "variable": "$color-orange",
        "value": "#FF9800",
        "sassType": "value"
    },
    {
        "class": null,
        "variable": "$color-yellow",
        "value": "#FFEB3B",
        "sassType": "value"
    },
    {
        "class": null,
        "variable": "$color-green",
        "value": "#28A745",
        "sassType": "value"
    },
    {
        "class": null,
        "variable": "$color-blue",
        "value": "#2D578F",
        "sassType": "value"
    },
    {
        "class": null,
        "variable": "$other-color-map",
        "value": [
            {
                "white": "$color-white"
            },
            {
                "black": "$color-black"
            },
            {
                "light": "$color-light"
            },
            {
                "dark": "$color-dark"
            },
            {
                "success": "$color-success"
            },
            {
                "danger": "$color-danger"
            },
            {
                "warning": "$color-warning"
            },
            {
                "divider": "$color-divider"
            },
            {
                "link": "$color-link"
            }
        ],
        "sassType": "list"
    }
]

``

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 462 6/3/2020

The initial development release.