Created
March 5, 2021 23:02
-
-
Save waseemsadiq/77177eaaafa900cd19b4f2d0c530d6c7 to your computer and use it in GitHub Desktop.
HTML to Tailwind class replacement - related to https://gist.github.com/learncss/0dece543913dd601c777b6909b2e30c9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'ext:pages.template.filter.tailwindclasses' => [ | |
'enable' => true | |
], | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ExtPagesTemplateFilterTailwindclasses extends ComPagesTemplateFilterAbstract | |
{ | |
public function filter(&$text) | |
{ | |
// class="container wrapper" | |
$text = preg_replace("/class=\"container wrapper\"/","class=\"container border flex flex-col justify-start v-spaced p-4\"", $text); | |
// class="row | |
$text = preg_replace("/class=\"row/","class=\"-mx-2 flex flex-wrap", $text); | |
// class="col" | |
$text = preg_replace("/class=\"col\"/","class=\"w-full flex px-2 flex-col", $text); | |
// class="col | |
$text = preg_replace("/class=\"col /","class=\"w-full flex px-2 flex-col ", $text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment