Socket
Socket
Sign inDemoInstall

cssparser

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssparser - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

test/sample.css

2

package.json

@@ -16,3 +16,3 @@ {

],
"version": "0.9.0",
"version": "0.9.1",
"preferGlobal": true,

@@ -19,0 +19,0 @@ "repository": {

@@ -36,17 +36,20 @@ ![Travis Build Status - Master](https://img.shields.io/travis/cwdoh/cssparser.js/master.svg)

$ npm install cssparser
or
$ npm install cssparser -g
```bash
$ npm install cssparser
```
or
```bash
$ npm install cssparser -g
```
Then execute and you can generate JSON file from command-line.
$ cssparser cssFile
or
$ cssparser cssFile -o output_file
```bash
$ cssparser cssFile
```
or
```bash
$ cssparser cssFile -o output_file
```
###from CommonJS Module

@@ -56,15 +59,16 @@

// getting parser module
var cssparser = require("cssparser");
// create new instance of Parser
var parser = new cssparser.Parser();
// parse
var ast = parser.parse(raw)
```javascript
// getting parser module
var cssparser = require("cssparser");
// getting json
var json = ast.toJSON(type)
// create new instance of Parser
var parser = new cssparser.Parser();
// parse
var ast = parser.parse(raw)
// getting json
var json = ast.toJSON(type)
```
##Generating parser from source

@@ -74,10 +78,13 @@

$ git clone https://github.com/cwdoh/cssparser.js.git
$ npm install
```bash
$ git clone https://github.com/cwdoh/cssparser.js.git
$ npm install
```
###Generating parser from source
$ npm run build
```bash
$ npm run build
```
##JSON Structure

@@ -98,3 +105,5 @@

cssparser example/test.css --console -i 4
```bash
cssparser example/test.css --console -i 4
```

@@ -107,10 +116,10 @@ ###Input

@media screen {
* {
position: absolute;
}
* {
position: absolute;
}
}
.footer {
position: fixed;
bottom: 0;
bottom: 0 !important;
width: 1rem;

@@ -144,2 +153,3 @@ }

{
"type": "rule",
"selectors": [

@@ -155,2 +165,3 @@ "*"

{
"type": "rule",
"selectors": [

@@ -161,3 +172,3 @@ ".footer"

"position": "fixed",
"bottom": 0,
"bottom": "0 !important",
"width": "1rem"

@@ -167,2 +178,3 @@ }

]
```

@@ -227,3 +239,4 @@

"property": "bottom",
"value": 0
"value": 0,
"important": true
},

@@ -243,2 +256,3 @@ {

}
```

@@ -367,3 +381,4 @@

"value": 0
}
},
"important": true
},

@@ -400,3 +415,5 @@ {

* 0.9.0-alpha - March 5th, 2016
* 0.9.1 - March 8th, 2017
* Added 'rule' type on the css style node when simple mode.
* 0.9.0 - March 5th, 2017
* Fully rewrited parser.

@@ -403,0 +420,0 @@ * Supports three modes such as simple, deep, atomic.

@@ -8,2 +8,3 @@ class QualifiedRule extends CSSObject {

return {
type: 'rule',
selectors: toSimple(this.get('selectors')),

@@ -27,3 +28,7 @@ declarations: toSimple(this.get('value'))

var json = {}
json[toSimple(this.get('property'))] = toSimple(this.get('value'))
var value = toSimple(this.get('value'))
if (this.get('important', false)) {
value += ' !important'
}
json[toSimple(this.get('property'))] = value

@@ -30,0 +35,0 @@ return json

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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