🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

jscssp

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscssp

JSCSSP is a CSS parser. It parses a string containing CSS styles and outputs a CSS Object Model.

0.5.0
latest
npm
Maintainers
0
Created
Source

JavaScript CSS Parser

Usage

var CSSParser = require("jscssp").CSSParser;
var cssParser = new CSSParser;
cssParser.parse("h1 {color: red}")
-> {cssRules: 
  [{type: 1
    , parsedCssText: 'h1 {\n  color: red;\n}'
    , declarations: {type: 1000
      , property: 'color'
      , values: [{value: 'red'
        , type: 1
        , name: null
        , parentRule: null
        , parentStyleSheet: [Circular]
        }
      ]
      , valueText: 'red'
      , priority: false
      , parsedCssText: 'color: red;'
      , parentStyleSheet: null
      , parentRule: null
      }
    , mSelectorText: 'h1'
    , parentStyleSheet: [Circular]
    , parentRule: null
    , currentLine: 0
    }
  ]
, variables: {}
}

Installation (for Node.js)

$ npm install jscssp

Tests

git submodule update --init
open test/index.html

To see test results in the console run

node test/*_test.js

Analogs

  • Sheet.js

Keywords

CSS

FAQs

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