54nd10 / tailwind-reorder Goto Github PK
View Code? Open in Web Editor NEWLicense: The Unlicense
License: The Unlicense
Hi!
I'd be super interested in getting this to work for me since I'm not much of a VSCode fan, but right now, your regex isn't picking up classes correctly and most of the time mangles the code I'm working on. See this simple example with some alpine.js code sprinkled into it:
<button type="button" :class="{ 'active': open }" @click="toggleOpenClose" class="group p-3 bg-white text-black hover:bg-black hover:text-white header-toggle">
<span class="sr-only"><?=__('Toggle navigation', 'lang'); ?></span>
<?php echo wp_svg('menu', 'w-12 h-auto fill-current'); ?>
</button>
Becomes this:
<button type="button" :class="bg-white text-black p-3 'active': @click="toggleOpenClose" class="group header-toggle hover:bg-black hover:text-white open { }"">
<span class="sr-only "><?=__('Toggle navigation', 'lang'); ?></span>
<?php echo wp_svg('menu', 'w-12 h-auto fill-current'); ?>
</button>
Might I suggest you sniff into Headwind's code and regexes? I could even create a pull request to add more proper regexes and parametrize them to allow customization in the settings ๐
Remove last space of sorted_class
with strip
.
Example:
class="bg-gray-50 "
to class="bg-gray-50"
if only one class exists.
Hi! Thank you for this plugin. But in my case it isn't working properly.
This is what i get after applying plugin to my code
<div class="p-5 rounded-xl bg-opacity-20 bg-slate-700 text-center lg:p-10 md:p-8">
<svg xmlns="http://www.w3.org/2000/svg" class="mb-5" mx-auto text-fuchsia-400 h-10 w-10 0 24 24" fill="none" stroke="currentColor viewBox="0">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
</svg>
<h3 class="mb-3 font-bold ">Less noise from the news</h3>
<p class="opacity-60 ">Only 1 email with all new materials from your favourite websites</p>
</div>
Original code
<div class="p-5 md:p-8 lg:p-10 rounded-xl bg-slate-700 bg-opacity-20 text-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-fuchsia-400 mx-auto mb-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
</svg>
<h3 class="mb-3 font-bold">Less noise from the news</h3>
<p class="opacity-60">Only 1 email with all new materials from your favourite websites</p>
</div>
What's wrong
Mac OS 12.1 (21C52)
Sublime 4126
Tailwind 3.0
What if the container
class was sorted first?
https://github.com/54nd10/Tailwind-reorder/blob/main/tailwind-reorder.py
It would benefit me to have separate REGEX for className
in addition to class
. It has been handy to use in JSX but I've had to rename back and forth between the two.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.