46 Commits

Author SHA1 Message Date
Robin Malfait
152202916c
Allow for recursively applying user defined classes (#2832) 2020-11-26 15:05:06 +01:00
Stefan Fisk
1e0fc09e0a
Fix !important on multiple selectors #2823 (#2824)
* Add failing test for #2823

* cleanup string literals

* use prettier for toMatchCSS diffs

* make sure that importants are applied correctly

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2020-11-26 14:53:58 +01:00
Adam Wathan
6fa213d5d8 Don't calculate didYouMean suggestions prematurely 2020-10-19 09:40:28 -04:00
Matt Rothenberg
7572b0256c
feat: Show "Did you mean?" message when users @apply errant class (#2590)
* feat: suggest alternate classes if @apply value not found

* fix: remove only from test

* feat: move logic to applyComplexClasses

* fix: remove whitespace

* remove unused files

* did you mean suggestion
2020-10-19 09:35:22 -04:00
Adam Wathan
c1a7e94e65 Rename export 2020-10-18 15:43:50 -04:00
Adam Wathan
a5ba851c88 Replace old apply implementation files 2020-10-18 15:43:50 -04:00
Adam Wathan
782a828c81 Switch to new apply implementation 2020-10-18 15:43:50 -04:00
Adam Wathan
38b4eeb288 Prettier likes parens a lot now
git blame is now broken forever.
2020-10-16 15:39:44 -04:00
Adam Wathan
e3ed12782f Update prettier 2020-10-16 13:30:06 -04:00
Adam Wathan
ef149cfafb Optimize rebuilds in long-running processes 2020-08-19 10:21:26 -04:00
Adam Wathan
c252e33254 Get shadow lookup working-ish with new apply approach 2020-08-13 12:14:26 -04:00
Adam Wathan
36fc03b16d Add initial support for applying variants and other complex classes 2020-08-12 19:47:21 -04:00
Adam Wathan
8331d9fb24 Support applying non-prefixed class when using important scope 2019-08-06 08:23:47 -04:00
James Wee
382075731d Added Prefix Selector support via important config 2019-07-11 17:07:24 +12:00
Adam Wathan
664f923312 Move prefix option to top-level in config 2019-02-01 12:32:16 -05:00
Jesse
55f8207d21 Fix apostrophe in error 2018-10-17 11:47:14 +02:00
Adam Wathan
750b62c5d2 Enable shadowLookup by default 2018-09-21 14:55:54 -04:00
Adam Wathan
8d5aee4a77 Refactor findClass 2018-09-15 08:24:42 -04:00
Adam Wathan
39ec3b14cc Use existing prefixSelector function 2018-09-14 16:22:49 -04:00
Rouven Hurling
d7d715a94e
fix code, test and style 2018-09-14 17:04:54 +02:00
Rouven Hurling
8042c268d4
Fix travis issue (missed an opening bracket) 2018-09-14 15:27:43 +02:00
Rouven Hurling
f629b647da
Implement optional prefix substitution in @apply 2018-09-14 15:10:17 +02:00
Adam Wathan
80baf4aa17 Pass generated utilities around as array instead of root
When you do something like container.before(someRoot), PostCSS actually *mutates* someRoot, leaving it empty and moving its contents before the container. container.before(arrayOfNodes) on the other hand does no weird mutation.

This PR makes sure generatedUtilities is an array of nodes instead of a PostCSS container to avoid this unexpected mutation. It makes it a bit more work to walk those nodes if they need to be transformed, but I think it's worth the trade-off. Can always write a helper function around that if the boilerplate starts to feel repetitive.
2018-07-11 19:14:33 -04:00
Adam Wathan
24e1385aca Only enable shadow lookup if shadowLookup experiment is enabled 2018-07-11 11:51:47 -04:00
Adam Wathan
cfe492220c Refactor duplication 2018-07-11 11:45:45 -04:00
Adam Wathan
cdbea36564 Fallback to shadow table 2018-07-11 09:56:11 -04:00
Adam Wathan
eacc4635b6 Match apply rules against a lookup table instead of searching 2018-02-28 20:34:16 -05:00
Adam Wathan
ec9b9b99bd Add support for making applied rules important 2017-12-13 13:00:37 -05:00
Adam Wathan
88ff6bdbc3 Don't normalize custom property sets in at-apply 2017-12-13 12:51:35 -05:00
Jack McDade
c84886e32e Adjust syntax style to fit standards 2017-12-08 16:15:58 -05:00
Jack McDade
97ef316af8 Prevent @apply from adding !important. 2017-12-08 16:05:54 -05:00
Adam Wathan
7d6d0af65c Add more detail to @apply errors 2017-11-29 10:16:38 -05:00
Adam Wathan
447bc873d8 Prettier-ignore long error strings 2017-11-16 08:16:59 -05:00
Adam Wathan
538a854a73 Don't allow applying classes that appear in multiple rulesets
This can result in unexpected behavior, so explicitly erroring is best.
We can of course add support for this later if we see real value in it
and can come up with predictable rules for how it should work.
2017-11-16 07:54:40 -05:00
Adam Wathan
6807e45e1e Expect onError function is always provided
This can't really be optional.
2017-11-16 07:51:56 -05:00
Adam Wathan
e65b2df5a8 Improve error messages 2017-11-13 11:28:31 -05:00
Adam Wathan
c4305d0c07 Don't allow @applying classes that ever appear inside of an at-rule
This is too complex to easily support; better to explicitly error for
now vs. the current behavior which is just silently doing something
other than you probably expect.
2017-11-10 12:18:20 -05:00
David Hemphill
9dbf5881cd fix eslint issues 2017-11-06 15:00:55 -05:00
David Hemphill
ec607968cf Add ESLinting and Prettier formatting and run an initial format on the codebase 2017-11-06 15:00:00 -05:00
Adam Wathan
b2b95d5738 Register config file with Webpack for watching
This change tells Webpack (for those using it) that the config file
used should be tracked as a dependency and that the CSS should be
re-compiled if that config file changes.

It's careful to make sure the config file is loaded fresh every single
time to avoid weird caching issues.
2017-11-03 09:54:15 -04:00
Adam Wathan
9a880d43ea Escape class names provided in @apply
Without this, can't mixin stuff like .w-1/4.
2017-10-06 15:40:40 -04:00
Adam Wathan
6bbbe47e9b Refactor insertBefore references to simpler before 2017-08-28 11:26:17 -04:00
David Hemphill
2ef01837a9 Convert new stuff to use ES6 modules 2017-08-27 18:02:41 -04:00
Adam Wathan
525146fb32 Format everything uses 2 spaces instead of 4 2017-08-27 18:02:41 -04:00
Adam Wathan
1e1d45e092 Break Tailwind out into 3 private plugins, bake in cssnext and stylefmt 2017-08-27 18:02:41 -04:00
David Hemphill
aa46fb9211 Restructure and add build process 2017-08-27 18:02:41 -04:00