Sublime Forum

Help to convert Bootstrap to Tachyons



Could anyone point me to the right direction to write a plugin that will convert CSS classes from Bootstrap to tachyons? For example:


<-- bootstrap -->
<div class="row">
<div class="col-xs-12 col-md-3">100/25</div>
<div class="col-xs-12 col-md-6">100/50</div>
<div class="col-xs-12 col-md-3">100/25</div>


<-- tachyons -->
<div class="cf-ns nl2 nr2">
<div class="fl-ns w-25-ns ph2">100/25</div>
<div class="fl-ns w-50-ns ph2">100/50</div>
<div class="fl-ns w-25-ns ph2">100/25</div>

The plugin needs to read the classes and replace them respectively.

However, I’m not a developer, so I need a little push here.

Thank you,


Why is this forum unfriendly?

First of all, writing a plugin is unnecessary if this is something you’re only going to do once, and then stick to writing tachyons syntax. Basically, don’t write a plugin if it’s not something you’re going to be using repeatedly.

If you’re only doing this once, and with a limited number of class names, I’d use the built-in Find-And-Replace that comes with Sublime Text (CtrlOrCmd+H). If doing this on a lot of files with many different class names, I’d probably write a shell script that uses sed and the s command (substitute) and run it on all of the files.

If you still want to write a plugin, here’s the Sublime Text Python API. And here’s the first result of googling “Sublime Text create plugin”:

Good luck!



Thank you!