237 Commits

Author SHA1 Message Date
Adam Wathan
77d3f7590e Don't purge components, don't purge if paths empty, add empty purge to config stub 2020-04-29 16:14:08 -04:00
Adam Wathan
64b6c955c7 Improve PurgeCSS integration
- Add better Pug support
- Add "modes", with "all" and "conservative" by default
- Allow passing options through to PurgeCSS
- Rename `paths` to `content` to match PurgeCSS
2020-04-28 09:51:27 -04:00
Adam Wathan
b0ac3c50cb Support purging Pug templates a bit better 2020-04-27 22:18:21 -04:00
Adam Wathan
4c3e97c9d4 Make PurgeCSS regex compatible with node 8 2020-04-27 21:43:28 -04:00
Adam Wathan
ec0b7a2be1 Integrate PurgeCSS directly into Tailwind 2020-04-27 21:24:49 -04:00
Adam Wathan
ebd157f16e Add group-focus variant 2020-04-16 12:51:12 -04:00
Adam Wathan
08c69116ef Support import syntax even if not using postcss-import 2020-01-25 12:14:01 -05:00
Adam Wathan
6343d1ec7c Apply configured prefix to the .group class for group-hover variants 2019-11-25 11:47:00 -05:00
Adam Wathan
2b91157760 Don't watch files in node_modules 2019-10-22 09:50:26 -04:00
Adam Wathan
eb24d5067c Fix style 2019-10-12 12:53:32 -04:00
Serhii Pashchenko
8045d654d2 Fix ESLint error :* 2019-09-11 13:06:59 +03:00
Serhii Pashchenko
73f72d25e3 Fix unresolved modules in config watcher 2019-09-11 12:53:44 +03:00
Serhii Pashchenko
4a15678abb Make dependencies of config watchable 2019-08-11 12:32:46 +03:00
Adam Wathan
8331d9fb24 Support applying non-prefixed class when using important scope 2019-08-06 08:23:47 -04:00
Adam Wathan
19c74b106a Merge branch 'add-prefix-selector-support' of git://github.com/pxwee5/tailwindcss into pxwee5-add-prefix-selector-support 2019-08-06 07:56:34 -04:00
Adam Wathan
81b10be134 Fix conflicts 2019-07-20 11:22:09 -04:00
Adam Wathan
b11db0e06e
Merge pull request #1024 from tailwindcss/first-last-child-variants
Add first-child and last-child variants
2019-07-20 11:16:55 -04:00
Adam Wathan
78554a34d2 Rename first-child and last-child to first and last 2019-07-20 11:14:25 -04:00
Cody
d4aac290ac add odd and even nth child pseudo selectors 2019-07-14 00:10:08 -05:00
ecrmnn
66e75b89ab Replaces use of Lodash isArray with built-in Array.isArray 2019-07-13 16:52:07 +02:00
Adam Wathan
893f5c049a Add first-child and last-child variants 2019-07-12 12:53:52 -04:00
James Wee
382075731d Added Prefix Selector support via important config 2019-07-11 17:07:24 +12:00
Adam Wathan
b1242a0810 Fix conflicts 2019-07-10 08:29:58 -04:00
Adam Wathan
5080129b71
Merge pull request #732 from GeoffSelby/add-disabled-variant
Add `disabled` variant
2019-07-10 08:27:23 -04:00
Adam Wathan
a80720a8c6 Remove unused import 2019-06-20 11:24:54 -04:00
Christopher Willard
1efc5d1d44 Add support for :visited state variant 2019-06-18 07:27:40 -04:00
Adam Wathan
eeb2947204 Properly handle pseudo-elements with group-hover variant 2019-06-13 07:52:37 -04:00
Adam Wathan
737f1ecde0 Append variant pseudo-selectors after classes instead of replacing entire selector 2019-06-12 09:15:06 -04:00
Adam Wathan
1d10f20b48 Error when someone tries to use 2019-06-01 15:51:02 -04:00
Kyle Coburn
5056363090 Fix formatting empty root 2019-04-19 20:32:54 -07:00
Adam Wathan
93184084c6 Rename formatNodes to formatCSS 2019-04-17 08:07:42 -04:00
Adam Wathan
de1884fdd9 Fix formatting 2019-04-16 11:49:12 -04:00
Adam Wathan
c98cc12d35 Remove dependency on perfectionist, implement simple formatting from scratch 2019-04-16 11:43:17 -04:00
Adam Wathan
048bd040b7 Fix @screen not working, add simple test 2019-03-16 14:19:22 -04:00
Adam Wathan
525d03b7dc Support unquoted lists as default theme function values 2019-03-12 21:20:31 -04:00
Geoff Selby
64cea138ee Add disabled variant
This commit adds a `disabled` variant to the Tailwind core. Not sure if/where this would be used by default.
2019-03-07 22:37:44 -06:00
Adam Wathan
53ca284553 Remove config() function in favor of theme()
The only reason the config() helper function existed was to access your design tokens in your CSS, like:

```css
.foo {
  color: config('colors.blue')
}
```

Now that design tokens are nested in the new `theme` section, using the `config()` function is a bit more verbose:

```css
.foo {
  color: config('theme.colors.blue')
}
```

This PR removes the `config()` function in favor of a new `theme()` function that is already scoped to the `theme` section of the config:

```css
.foo {
  color: theme('colors.blue')
}
```

I can't think of any reason at all why you would need to access the non-theme values in your config from your CSS (like enabled variants, or your list of plugins), and the word `theme` is much more expressive than `config`, so I think this is a worthwhile change.
2019-03-01 08:35:24 -05:00
Adam Wathan
007231fbfc Require plugin authors to manually escape variants
Not 100% convinced this is a net positive change, but I regret not having done things this way at the beginning.

In 0.x, we pass the `separator` and `className` values already escaped, so `:` comes through as `\:` for example, and `w-1/2` comes through as `w-1\/2`.

At first this sounds fine, less work for the plugin author right? But CSS escaping rules are kind of complicated and you have to escape characters differently depending on whether or not they are at the start of an identifier.

For example, it's totally fine for a class to contain a zero (`0` ), but it can't _start_ with a zero. For a class to start with a zero, it needs to be escaped like this: `\30 `

This means that as a general rule, trying to escape the individual segments of a class separately is a bad idea — you should escape the class as a whole so only the necessary escaping is applied. We break this rule when we pre-escape the separator and className for plugin authors who use the `modifySelectors` function.

We already require users to manually escape class names when they are using `addUtilities` or `addComponents`, so to me it feels more consistent for things to work this way and it's how they should have worked from day one.

Basically this code:

```js
function({ addVariant }) {
  addVariant('first-child', ({ modifySelectors, separator }) => {
    modifySelectors(({ className }) => {
      return `.first-child${separator}${className}:first-child`
    })
  })
},
```

...would need to be re-written like this if I merge this change:

```js
function({ addVariant, e }) {
  addVariant('first-child', ({ modifySelectors, separator }) => {
    modifySelectors(({ className }) => {
      return `.${e(`first-child${separator}${className}`)}:first-child`
    })
  })
},
```

Although I think this is the right way for this to work, I hesitate because it's a breaking change that makes any variant plugins authored for 0.x incompatible with 1.x. It's an easy fix on the plugin author's part, but it's still annoying.

I'm leaning towards merging so I don't regret this even more later when the plugin ecosystem is a lot bigger. Anyone have any thoughts?
2019-02-28 10:17:09 -05:00
Adam Wathan
4763840582 Merge branch 'master' into next 2019-02-15 14:31:17 -05:00
Adam Wathan
c0ec2c5fbe Allow users to customize default variant placement 2019-02-15 10:52:01 -05:00
Adam Wathan
690c7f2d52 Convert preflight to plugin 2019-02-07 15:19:54 -05:00
Adam Wathan
4a505be390 Load plugin base styles at @tailwind base 2019-02-07 15:09:18 -05:00
Adam Wathan
b8f965179c Finish merge of master 2019-02-07 13:58:47 -05:00
Adam Wathan
8aabccb8d4 Fix code style 2019-02-06 14:29:05 -05:00
Adam Wathan
b544febfcb Use root instead of array to unify code paths 2019-02-06 14:23:38 -05:00
Justin Anastos
40bb6c619d Add nested atRule support to substituteResponsiveAtRules 2019-02-05 10:15:59 -05:00
Adam Wathan
b036cac4b5 Fix code style 2019-02-01 12:32:50 -05:00
Adam Wathan
ec1bdd27ec Move screens into theme config 2019-02-01 12:32:50 -05:00
Adam Wathan
e8d16fcdb5 Move separator to top level config option 2019-02-01 12:32:50 -05:00
Adam Wathan
664f923312 Move prefix option to top-level in config 2019-02-01 12:32:16 -05:00