Gathering detailed insights and metrics for postcss-sorting
Gathering detailed insights and metrics for postcss-sorting
Gathering detailed insights and metrics for postcss-sorting
Gathering detailed insights and metrics for postcss-sorting
@types/postcss-sorting
TypeScript definitions for postcss-sorting
css-declaration-sorter
Sorts CSS declarations fast and automatically in a certain order.
postcss-sort-media-queries
PostCSS plugin for sorting and combining CSS media queries with mobile first / **desktop first methodologies
sugarss
Indent-based CSS syntax for PostCSS
PostCSS plugin to keep rules and at-rules content in order.
npm install postcss-sorting
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
518 Stars
320 Commits
31 Forks
8 Watching
2 Branches
13 Contributors
Updated on 22 Nov 2024
Minified
Minified + Gzipped
JavaScript (71.2%)
CSS (28.18%)
HTML (0.61%)
Cumulative downloads
Total Downloads
Last day
-0.5%
336,647
Compared to previous day
Last week
2.8%
1,694,703
Compared to previous week
Last month
8.8%
7,086,627
Compared to previous month
Last year
1.6%
77,529,071
Compared to previous year
PostCSS plugin to keep rules and at-rules content in order.
Lint and autofix stylesheet order with stylelint-order.
1npm install --save-dev postcss postcss-sorting
The plugin has no default options. Everything is disabled by default.
order
: Specify the order of content within declaration blocks.properties-order
: Specify the order of properties within declaration blocks.unspecified-properties-position
: Specify position for properties not specified in properties-order
.throw-validate-errors
: Throw config validation errors instead of showing and ignoring them. Defaults to false
.Comments that are before node and on a separate line linked to that node. Shared-line comments are also linked to that node. Shared-line comments are comments which are located after a node and on the same line as a node.
1a { 2 top: 5px; /* shared-line comment belongs to `top` */ 3 /* comment belongs to `bottom` */ 4 /* comment belongs to `bottom` */ 5 bottom: 15px; /* shared-line comment belongs to `bottom` */ 6}
Some at-rules, like control and function directives in Sass, are ignored. It means rules won't touch content inside these at-rules, as doing so could change or break functionality.
Plugin will ignore rules, which have template literal interpolation, to avoid breaking the logic:
1const Component = styled.div` 2 /* The following properties WILL NOT be sorted, because interpolation is on properties level */ 3 z-index: 1; 4 top: 1px; 5 ${props => props.great && 'color: red'}; 6 position: absolute; 7 display: block; 8 9 div { 10 /* The following properties WILL be sorted, because interpolation for property value only */ 11 z-index: 2; 12 position: static; 13 top: ${2 + 10}px; 14 display: inline-block; 15 } 16`;
See PostCSS docs for more examples.
Add postcss-cli and PostCSS Sorting to your project:
1npm install postcss postcss-cli postcss-sorting --save-dev
Create a postcss.config.js
with PostCSS Sorting configuration:
1module.exports = { 2 plugins: { 3 'postcss-sorting': { 4 order: [ 5 'custom-properties', 6 'dollar-variables', 7 'declarations', 8 'at-rules', 9 'rules', 10 ], 11 12 'properties-order': 'alphabetical', 13 14 'unspecified-properties-position': 'bottom', 15 }, 16 }, 17};
Or, add the 'postcss-sorting'
section to your existing postcss-cli
configuration file.
Next execute:
1npx postcss --no-map --replace your-css-file.css
For more information and options, please consult the postcss-cli docs.
Add gulp-postcss and PostCSS Sorting to your build tool:
1npm install postcss gulp-postcss postcss-sorting --save-dev
Enable PostCSS Sorting within your Gulpfile:
1let gulp = require('gulp'); 2let postcss = require('gulp-postcss'); 3let sorting = require('postcss-sorting'); 4 5exports['sort-css'] = () => { 6 return gulp 7 .src('./css/src/*.css') 8 .pipe( 9 postcss([ 10 sorting({ 11 /* options */ 12 }), 13 ]) 14 ) 15 .pipe(gulp.dest('./css/src')); 16};
This plugin available as Sublime Text, Atom, VS Code, and Emacs plugin. Though, seems all these plugins are not maintained.
stylelint and stylelint-order help lint stylesheets and let you know if stylesheet order is correct. Also, they could autofix stylesheets.
I recommend Prettier for formatting stylesheets.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
9 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 7
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 4/28 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More