nunomaduro / termwind

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
MIT License
2.29k stars 78 forks source link

Refactor font-bold and underline #52

Closed xiCO2k closed 3 years ago

xiCO2k commented 3 years ago

To avoid interfering with the prepend(), changed the classes font-bold and underline

Code

render(<<<'HTML'
    <div class="my-1">
        <span>For text on 🍃 Termwind we support:</span>
        <ul class="mt-2">
            <li class="font-bold text-color-white">
                Font Bold
            </li>
            <li class="italic text-color-white">
                Italic
            </li>
            <li class="underline text-color-white">
                Underline
            </li>
            <li class="line-through text-color-white">
                Line Through
            </li>
            <li class="font-bold italic text-color-white underline line-through">
                All Together
            </li>
        </ul>
    </div>
HTML);

Before

image

After

image

nunomaduro commented 3 years ago

Coverage is failing, can you check?

xiCO2k commented 3 years ago

Yes to not remove the options completely since there may be cases that we will use it, added the coverage ignore for that.

// @codeCoverageIgnoreStart
foreach ($this->properties['options'] as $option) {
    $options[] = $option;
}
// @codeCoverageIgnoreEnd

if you want to remove it completely let me know.

nunomaduro commented 3 years ago

If we are not using them, remove it.

xiCO2k commented 3 years ago

Got it.

sebdesign commented 3 years ago

This PR breaks methods which modify the content, e.g.: truncate, uppercase, capitalize, snakecase, because the options are now hardcoded into the content.

E.g. <div class="font-bold uppercase">text</div> renders <bg=default;options=>\e[1MTEXT\e[0M</>.

xiCO2k commented 3 years ago

@sebdesign Thanks for catching it.

We have other ones like invisible, line-through that will have the same problem with text mutation.

Can you create an issue with that information?

Thanks.