Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benface committed Feb 5, 2020
1 parent 5bd68bc commit 1a037d7
Show file tree
Hide file tree
Showing 7 changed files with 1,962 additions and 1,946 deletions.
3 changes: 2 additions & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"git": {
"tagName": "v%s"
"tagName": "v%s",
"requireCleanWorkingDir": false
}
}
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - XXXX-XX-XX
## [2.0.0] - 2020-02-05

### Added
- Added a `children-not-first` variant (e.g. `children:not-first:border-t`)

### Changed
- Changed to use Tailwind 1.2’s new plugin definition syntax
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ npm install tailwindcss-children
// tailwind.config.js
module.exports = {
variants: {
display: ['children', 'default', 'children-first', 'children-last', 'children-odd', 'children-even', 'children-hover', 'hover', 'children-focus', 'focus', 'children-focus-within', 'focus-within', 'children-active', 'active', 'children-visited', 'visited', 'children-disabled', 'disabled', 'responsive'],
display: ['children', 'default', 'children-first', 'children-last', 'children-odd', 'children-even', 'children-not-first', 'children-hover', 'hover', 'children-focus', 'focus', 'children-focus-within', 'focus-within', 'children-active', 'active', 'children-visited', 'visited', 'children-disabled', 'disabled', 'responsive'],
},
plugins: [
require('tailwindcss-children'),
Expand Down Expand Up @@ -47,6 +47,10 @@ The above configuration would generate the following CSS:
display: block;
}

.children\:not-first\:block > * + * {
display: block;
}

.children\:hover\:block > :hover {
display: block;
}
Expand Down Expand Up @@ -101,7 +105,7 @@ The above configuration would generate the following CSS:
Which you can then use in your HTML like this:

```html
<ul class="children:block children:border-b children:border-gray children:last:border-b-0 children:hover:bg-gray">
<ul class="children:block children:not-first:border-t children:border-gray children:hover:bg-gray">
<li>
First item
</li>
Expand Down Expand Up @@ -133,4 +137,4 @@ You can also override `children:` classes on specific children if needed:
</ul>
```

The above depends on the order of the generated CSS, so make sure to add the `default` variant *after* the `children` one in the array of variants (as well as the `hover` variant after the `children-hover` variant if you want to override a `children-hover:` utility, etc.).
The above depends on the order of the generated CSS, so make sure to add the `default` variant *after* the `children` one in the array of variants (as well as the `hover` variant after the `children-hover` variant if you want to override a `children:hover:*` utility, etc.).
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const childrenVariant = function(pseudoClass = null, childrenSelector = null) {

module.exports = plugin(function({ addVariant }) {
addVariant('children', childrenVariant());
addVariant('children-first', childrenVariant('first', ':first-child'));
addVariant('children-last', childrenVariant('last', ':last-child'));
addVariant('children-odd', childrenVariant('odd', ':nth-child(odd)'));
addVariant('children-even', childrenVariant('even', ':nth-child(even)'));
addVariant('children-not-first', childrenVariant('not-first', '* + *'));
addVariant('children-hover', childrenVariant('hover'));
addVariant('children-focus', childrenVariant('focus'));
addVariant('children-focus-within', childrenVariant('focus-within'));
addVariant('children-active', childrenVariant('active'));
addVariant('children-visited', childrenVariant('visited'));
addVariant('children-disabled', childrenVariant('disabled'));
addVariant('children-first', childrenVariant('first', ':first-child'));
addVariant('children-last', childrenVariant('last', ':last-child'));
addVariant('children-odd', childrenVariant('odd', ':nth-child(odd)'));
addVariant('children-even', childrenVariant('even', ':nth-child(even)'));
addVariant('children-not-first', childrenVariant('not-first', '* + *'));
});
Loading

0 comments on commit 1a037d7

Please sign in to comment.