Skip to content

Version 0.3.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@Gigabyte5671 Gigabyte5671 released this 05 Jul 05:32
· 120 commits to main since this release

nth selectors are now supported πŸŽ‰
This includes:

  • :first-child
  • :nth-child
  • :last-child
  • :first-of-type
  • :nth-of-type
  • :last-of-type

This also introduces a new "fill" behaviour where missing elements are filled in up to the desired nth level. For example:

article section:nth-child(5) p {
    content: 'Fifth section.';
    font-style: italic;
}

Will produce:

<article>
    <section></section>
    <section></section>
    <section></section>
    <section></section>
    <section>
        <p>Fifth section.</p>
    </section>
</article>

Filling in these missing elements allows nth selector styles to still be applied, regardless of neighbouring elements.

This behaviour can be prevented by calling with fill set to 'no-fill':

cssToHtml(css, { fill: 'no-fill' });

Note: Cascading is always maintained.