744 Commits

Author SHA1 Message Date
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
5e935c10f7 Remove dependency on cssesc
Makes it easier to guarantee that our escape behavior stays in line with postcss-selector-parser if their internal implementation ever changes.
2019-02-27 16:40:19 -05:00
Adam Wathan
2f79cab8fa Switch from css.escape to cssesc
This is what postcss-selector-parser uses internally, best to rely on the same escaping logic everywhere.
2019-02-27 13:53:28 -05:00
Adam Wathan
b8f1078229 Use postcss-selector-parser class escape handling 2019-02-27 13:43:26 -05:00
Adam Wathan
12dafbe1b1 Make flex-grow/shrink customizable 2019-02-26 13:45:12 -05:00
Adam Wathan
2b89e09409 Split flexShrink to separate plugin 2019-02-26 10:33:34 -05:00
Adam Wathan
06ef9557b3 Split flexGrow to separate plugin 2019-02-26 10:30:44 -05:00
Adam Wathan
7af36e1274 Split flex into separate plugin 2019-02-26 10:25:06 -05:00
Adam Wathan
13b81f0b5c Split alignContent into separate plugin 2019-02-26 10:19:55 -05:00
Adam Wathan
ad282c6d8a Split justifyContent into separate plugin 2019-02-26 10:17:26 -05:00
Adam Wathan
04163056f6 Split alignSelf into separate plugin 2019-02-26 10:09:53 -05:00
Adam Wathan
435a7f97de Split alignItems into separate plugin 2019-02-26 10:09:06 -05:00
Adam Wathan
7f1c7f578e Split flexWrap into separate plugin 2019-02-26 10:08:02 -05:00
Adam Wathan
ad4f7739bb Split flexDirection into its own plugin 2019-02-26 10:04:21 -05:00
Adam Wathan
10106e2edc Move flex display utilities to display plugin 2019-02-26 10:02:25 -05:00
Adam Wathan
d0de252e47 Rename flex-no-grow/shrink to flex-grow/shrink-0 2019-02-26 09:13:17 -05:00
Adam Wathan
0db948f3e8 Fix style 2019-02-22 12:47:23 -05:00
Adam Wathan
8293631d76 Merge branch 'feature/cursors' of git://github.com/hacknug/tailwindcss into hacknug-feature/cursors 2019-02-22 12:46:00 -05:00
Nestor Vera
85957755dd Add new word-break utilities 2019-02-22 17:51:21 +01:00
Nestor Vera
dc02201a2d Allow users to configure cursors 2019-02-22 16:47:58 +01:00
Adam Wathan
db7f1e6728 Merge branch 'master' into next 2019-02-22 10:05:31 -05:00
Adam Wathan
10aa36533f Pass postcss to plugins explicitly 2019-02-22 09:50:36 -05:00
Adam Wathan
48b72304cb
Merge pull request #640 from MattStypa/build_refactor
CLI build process improvements
2019-02-21 15:08:12 -05:00
Nestor Vera
1bddb2511b Allow users to customize objectPostions 2019-02-21 12:51:15 +01:00
Adam Wathan
9925d6156d Rename tracking plugin to letterSpacing 2019-02-19 15:54:07 -05:00
Adam Wathan
ceb093e6a1 Rename leading plugin to lineHeight 2019-02-19 15:49:33 -05:00
Adam Wathan
3f9c4ec84b Rename roman to not-italic 2019-02-18 10:14:15 -05:00
Adam Wathan
87192f8922 Fix conflicts 2019-02-18 09:39:38 -05:00
Adam Wathan
3e468dd59d Revert renaming leading to lineHeight 2019-02-15 22:08:58 -05:00
Adam Wathan
914c581974 Revert renaming tracking to letterSpacing 2019-02-15 22:07:37 -05:00
Adam Wathan
c2f62c1c6c Split textStyle plugin into one plugin per CSS property 2019-02-15 16:12:49 -05:00
Adam Wathan
ec0b9ae68e Rename textColors to textColor 2019-02-15 15:31:06 -05:00
Adam Wathan
76b208dc83 Rename lists to listStyle 2019-02-15 15:30:43 -05:00
Adam Wathan
36c2a60766 Rename tracking to letterSpacing 2019-02-15 15:24:40 -05:00
Adam Wathan
ab9277d3eb Rename textSizes to fontSize 2019-02-15 15:21:27 -05:00
Adam Wathan
e9f86cc295 Rename svgStroke to stroke 2019-02-15 15:20:05 -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
45c5e69708 Update shadows to boxShadow in corePlugins 2019-02-14 15:34:07 -05:00
Adam Wathan
7abbf520df Rename svgFill to fill 2019-02-14 15:33:51 -05:00
Adam Wathan
b6b67e1c8c Rename shadows to boxShadow 2019-02-14 15:32:38 -05:00
Adam Wathan
4b717aad56 Rename leading plugin to lineHeight 2019-02-14 15:31:19 -05:00
Adam Wathan
af65b45a4c Rename fontWeights to fontWeight 2019-02-14 15:25:35 -05:00
Adam Wathan
856fdbc3dd Rename borderWidths to borderWidth 2019-02-14 15:24:20 -05:00
Adam Wathan
df8fe5afa6 Rename borderColors to borderColor 2019-02-14 15:23:22 -05:00
Adam Wathan
376daf3345 Rename backgroundColors to backgroundColor 2019-02-14 15:20:07 -05:00
Adam Wathan
d3c65e55af Rename fonts plugin to fontFamily 2019-02-14 14:39:08 -05:00
Adam Wathan
4754d225af Remove need for without function 2019-02-14 07:47:32 -05:00
Adam Wathan
d95d28eec8 Fix code style 2019-02-13 14:25:37 -05:00
Adam Wathan
2342d72c5e Use existing parameter 2019-02-13 14:22:45 -05:00