Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
prettier-plugin-tailwindcss
Advanced tools
A [Prettier](https://prettier.io/) plugin for Tailwind CSS that automatically sorts classes based on Tailwind's internal class sorting algorithm.
The prettier-plugin-tailwindcss npm package is a plugin for Prettier, the code formatter, that sorts Tailwind CSS classes automatically. It ensures that your Tailwind CSS classes are ordered consistently according to the recommended order from the Tailwind CSS documentation. This can help improve readability and maintainability of your code.
Sorting Tailwind CSS classes
This plugin will reorder the classes to follow the default Tailwind CSS order, for example, positioning classes like 'flex' and 'justify-center' would come before display and box model classes like 'p-4' and 'bg-red-500'.
"<div class='bg-red-500 p-4 flex justify-center'>Hello World</div>"
Headwind is a Visual Studio Code extension that also sorts Tailwind CSS classes automatically. It is similar to prettier-plugin-tailwindcss but is specifically designed for VS Code and does not require Prettier.
This package is a typed utility function to combine Tailwind CSS classes. While it does not sort classes, it provides a way to conditionally join class names together, which can be useful in conjunction with a sorting tool.
tailwind-merge is a utility to merge Tailwind CSS classes without duplicates and with optimized class precedence. It does not sort classes but ensures that the final class string is optimized for Tailwind CSS.
A Prettier plugin for Tailwind CSS that automatically sorts classes based on Tailwind's internal class sorting algorithm.
Note that
prettier-plugin-tailwindcss
is only compatible with Tailwind CSS v3
npm install --save-dev prettier prettier-plugin-tailwindcss
By default the plugin will look for a Tailwind config file (tailwind.config.js
) in the same directory as your Prettier config file. If your Tailwind config file is somewhere else you can specify this using the tailwindConfig
option (paths are resolved relative to the Prettier config file):
// prettier.config.js
module.exports = {
tailwindConfig: './styles/tailwind.config.js',
}
If a Tailwind config file cannot be found then the default Tailwind configuration will be used.
FAQs
A Prettier plugin for sorting Tailwind CSS classes.
The npm package prettier-plugin-tailwindcss receives a total of 1,885,452 weekly downloads. As such, prettier-plugin-tailwindcss popularity was classified as popular.
We found that prettier-plugin-tailwindcss demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.