
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
postcss-selector-source
Advanced tools
A PostCSS plugin for finding the original line and column position of your CSS selectors and declarations from your pre-processed SASS/SCSS/LESS/Stylus files
A PostCSS plugin for finding the original line and column position of your CSS selectors and declarations from your pre-processed SASS/SCSS/LESS/Stylus files.
npm install --save postcss-selector-source
This plugin doesn't edit your css, it returns an object of all of your used selectors and declarations with pointers to their original position.
var postcss = require('postcss');
var selectorSource = require('postcss-selector-source');
postcss([
selectorSource({
cssRootDir: './path/to/css/',
function(selectors) {
console.log(selectors);
}})
]).process(css);
Anything declared above this comment won't show up in the results.
@import 'bootstrap'; // won't be included
@import 'wont-be-included'; // won't be included
/* !ATTN - anything above me won't be included */
@import 'will-be-included';
.will-also-be-included {
}
[
{
"selector": ".first-selector",
"selectors": [".first-selector"],
"specificity": 10,
"decls": [{
"property": "content",
"value": "'first selector'",
"important": false,
"start": {
"line": 6,
"column": 3
},
"end": {
"line": 6,
"column": 28
},
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 7,
"column": 2,
"name": null
},
"end": {
"source": "src/test.scss",
"line": 7,
"column": 28,
"name": null
}
}
}, {
"property": "color",
"value": "#ffffff",
"important": true,
"start": {
"line": 7,
"column": 3
},
"end": {
"line": 7,
"column": 28
},
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 8,
"column": 2,
"name": null
},
"end": {
"source": "src/test.scss",
"line": 8,
"column": 35,
"name": null
}
}
}],
"start": {
"line": 5,
"column": 1
},
"end": {
"line": 7,
"column": 30
},
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 6,
"column": 0,
"name": null
},
"end": {
"source": "src/test.scss",
"line": 6,
"column": 17,
"name": null
}
}
}, {
"selector": ".first-selector",
"selectors": [".first-selector"],
"specificity": 10,
"decls": [{
"property": "content",
"value": "'first selector media query'",
"important": false,
"start": {
"line": 10,
"column": 7
},
"end": {
"line": 10,
"column": 44
},
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 11,
"column": 4,
"name": null
},
"end": {
"source": "src/test.scss",
"line": 11,
"column": 42,
"name": null
}
}
}, {
"property": "width",
"value": "500px",
"important": false,
"start": {
"line": 11,
"column": 7
},
"end": {
"line": 11,
"column": 19
},
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 12,
"column": 4,
"name": null
},
"end": {
"source": "src/_variable-includes.scss",
"line": 2,
"column": 21,
"name": null
}
}
}],
"start": {
"line": 9,
"column": 5
},
"end": {
"line": 11,
"column": 21
},
"params": [{
"property": "max-width",
"value": "300px"
}],
"originalPosition": {
"start": {
"source": "src/test.scss",
"line": 6,
"column": 0,
"name": null
},
"end": {
"source": "src/test.scss",
"line": 6,
"column": 17,
"name": null
}
}
}
...
]
FAQs
A PostCSS plugin for finding the original line and column position of your CSS selectors and declarations from your pre-processed SASS/SCSS/LESS/Stylus files
We found that postcss-selector-source 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.