Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-declaration-sorter

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-declaration-sorter

Sorts CSS declarations fast and automatically in a certain order.

  • 7.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9M
decreased by-13.15%
Maintainers
1
Weekly downloads
 
Created

What is css-declaration-sorter?

The css-declaration-sorter npm package is a tool used to automatically sort the declarations within CSS rulesets in a consistent order. It can be integrated into build processes to ensure that CSS is organized according to a specific order, which can make the CSS easier to read and maintain. It can also potentially lead to better compression when minifying CSS files.

What are css-declaration-sorter's main functionalities?

Sorting CSS declarations

This feature sorts the declarations within a CSS rule based on the specified order, such as 'smacss', 'concentric-css', or 'alphabetical'. The code sample shows how to use css-declaration-sorter with PostCSS to sort the declarations in a given CSS string.

const postcss = require('postcss');
const cssDeclarationSorter = require('css-declaration-sorter');

postcss([cssDeclarationSorter({ order: 'smacss' })])
  .process('a { color: yellow; z-index: 2; }')
  .then(result => console.log(result.css));

Integration with build tools

css-declaration-sorter can be integrated with build tools like Gulp to automatically sort CSS files during the build process. The code sample demonstrates how to set up a Gulp task that processes CSS files with css-declaration-sorter using PostCSS.

const gulp = require('gulp');
const postcss = require('gulp-postcss');
const cssDeclarationSorter = require('css-declaration-sorter');

gulp.task('css', function () {
  return gulp.src('src/*.css')
    .pipe(postcss([cssDeclarationSorter({ order: 'alphabetical' })]))
    .pipe(gulp.dest('dist'));
});

Other packages similar to css-declaration-sorter

Keywords

FAQs

Package last updated on 25 Mar 2024

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

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