
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
liferay-css-parse
Advanced tools
JavaScript CSS parser for nodejs and the browser.
$ npm install css-parse
var parse = require('css-parse');
// CSS input string
var css = "body { \n background-color: #fff;\n }";
var output_obj = parse(css);
// Position and Filename parameters
var output_obj_pos = parse(css, { position: true, filename: 'file.css' });
// Print parsed object as CSS string
console.log(JSON.stringify(output_obj, null, 2));
options
:
filename
- recommended for debuggingposition
- true
by default.Errors will have err.position
where position
is:
start
- start line and column numbersend
- end line and column numbersfilename
- filename if passed to optionssource
- source CSS stringIf you create any errors in plugins such as in rework, you must set the position
as well for consistency.
css:
body {
background: #eee;
color: #888;
}
parse tree:
{
"type": "stylesheet",
"stylesheet": {
"rules": [
{
"type": "rule",
"selectors": [
"body"
],
"declarations": [
{
"type": "declaration",
"property": "background",
"value": "#eee"
},
{
"type": "declaration",
"property": "color",
"value": "#888"
}
]
}
]
}
}
parse tree with .position
enabled:
{
"type": "stylesheet",
"stylesheet": {
"rules": [
{
"type": "rule",
"selectors": [
"body"
],
"declarations": [
{
"type": "declaration",
"property": "background",
"value": "#eee",
"position": {
"start": {
"line": 3,
"column": 3
},
"end": {
"line": 3,
"column": 19
}
}
},
{
"type": "declaration",
"property": "color",
"value": "#888",
"position": {
"start": {
"line": 4,
"column": 3
},
"end": {
"line": 4,
"column": 14
}
}
}
],
"position": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 5,
"column": 2
}
}
}
]
}
}
If you also pass in filename: 'path/to/original.css'
, that will be set
on node.position.filename
.
Parsed 15,000 lines of CSS (2mb) in 40ms on my macbook air.
MIT
FAQs
Liferay fork of CSS parser
The npm package liferay-css-parse receives a total of 414 weekly downloads. As such, liferay-css-parse popularity was classified as not popular.
We found that liferay-css-parse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.