Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dss-parser-variable

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dss-parser-variable

A variable parser for DSS (Documented Stylesheets)

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

dss-parser-variable NPM version Dependency Status Build Status

A @variable parser for documenting SCSS/LESS variables from Documented Style Sheets (DSS).

Usage

In a file test.scss:

/**
 * @name Colours
 * @variable white
 * @variable blue - Sky blue
 * @variable dark-red Button outlines
 */
$blue: #0000FF;
$dark-red: #FF0000;
$black: #000000;

In JavaScript:

var fs = require('fs'),
    dss = require('dss'),
    variableParser = require('dss-parser-variable');

dss.parser('variable', variableParser());

var scss = fs.readFileSync('test.scss'),
    options = {},
    callback = function(parsed){
      console.log(JSON.stringify(parsed, true, 4));
    };

dss.parse(scss, options, callback);

Will output:

{
    "blocks": [{
        "name": "Colours",
        "variable": [
            { "name": "blue", "description": "Sky blue", "value": "#0000FF" },
            { "name": "dark-red", "description": "Button outlines", "value": "#FF0000" }
        ]
    }]
}

Note there is no entry for white because the variable does not exist in the file, and there is no entry for black because there is no description in the DSS block. If you pass false flag to the constructor it will include variables that does not exist in the file, i.e. there would be entry for a white in output.

Keywords

FAQs

Package last updated on 10 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc