53 Commits

Author SHA1 Message Date
Robin Malfait
50b766dd47
Remove variants related code (#5465)
* drop `variants` related resolveConfig functionality

More AOT code that we could get rid of!

* drop more files!

I keep finding these unused files 😅

* Update setupContextUtils.js

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-10 09:34:27 -04:00
Robin Malfait
a34bd62bb6
Remove lodash (#5390)
* remove `lodash` usage

* implement custom cloneDeep to replace lodash's

* drop lodash in processPlugins

* add `toPath` utility

* add `tap` utility

* add `cloneDeep` utility

* drop lodash in evaluateTailwindFunctions

* add `defaults` utility

* drop lodash from `resolveConfig`

* remove `lodash` dependency
2021-09-06 14:15:10 -04:00
Jonathan Reinink
4f89215d88
Unify config helpers into single object (#5382)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-03 10:31:19 -04:00
Robin Malfait
7852d4f12f
Throw an error when applying the .group utility (#4666) 2021-09-01 18:08:35 +02:00
Robin Malfait
05e4ceee5b
Ensure purge.options.safelist is taken into account (#5356)
Also fixed a small typo 🤫
2021-09-01 17:23:32 +02:00
Robin Malfait
691ed02f63
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified

* unify JIT and AOT codepaths

* ensure `Object.entries` on undefined doesn't break

It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.

* drop AOT specific tests

These tests are all covered by JIT mode already and were AOT specific.

* simplify tests, and add a few

Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.

* add some todo's to make sure we warn in a few cases

* make `darkMode: 'media'`, the default

This also includes moving dark mode tests to its own dedicated file.

* remove PostCSS 7 compat mode

* update CLI to be JIT-first

* fix integration tests

This is not a _real_ fix, but it does solve the broken test for now.

* warn when using @responsive or @variants

* remove the JIT preview warning

* remove AOT-only code paths

* remove all `mode: 'jit'` blocks

Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.

* drop unused dependencies

* rename `purge` to `content`

* remove static CDN builds

* mark `--purge` as deprecated in the CLI

This will still work, but a warning will be printed and it won't show up
in the `--help` output.

* cleanup nesting plugin

We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.

* make sure integration tests run in band

* cleanup folder structure

* make sure nesting folder is available

* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
moonrailgun
b16afc9467
fix: mergeWith callback should process undefined case (#4843) 2021-07-02 16:55:32 -04:00
Sachin Raja
c0ee52060c
Generate plugin list file (#4725)
* Generate plugin list file

Removes the importing of all plugins in src/util/resolveConfig to avoid importing CSS.
Import the built plugin list file instead.

* Use `process.cwd()` instead of `__dirname` to resolve path

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

* Import core plugin list in resolveConfig test

* Generate plugin list prebabelify and on install

* Move generation from install to postinstall

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-06-23 14:13:03 -04:00
Adam Wathan
359252c9b4 Pass colors to theme closures 2021-06-19 14:31:37 -04:00
Robin Malfait
bfc61625d9
[WIP] Unify JIT and AOT code paths (#4188)
* WIP

* WIP

* Finish combining JIT and AOT plugins

Still lots of clean up that can be done in some of the more complex ones, but at least it's one file per plugin now.

* Remove unused import

* Fix AOT generation bugs

* Move corePlugins/index.js to corePlugins.js

* Convert JIT files to ESM

* Move tests

* Reorder core plugins to match JIT order

* Update AOT apply tests

* Unify utils

* Combine plugin lists to one single source of truth

* Finish resolving merge conflicts, fix tests

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-04-30 10:58:40 -04:00
Robin Malfait
df1732cce5
add ability to merge arrays of objects when using extend (#2700) 2020-10-29 10:17:10 -04:00
Robin Malfait
09d9262666
add the ability to deep merge extended configs (#2679) 2020-10-26 11:15:50 -04:00
Adam Wathan
11af870f30
Support extend in variants config (#2651)
* WIP

* It's alive

* Pull default variant order from config
2020-10-23 08:58:28 -04:00
Adam Wathan
b92f033f8b
Disable dark mode by default, rename config option to darkMode (#2631)
* Disable dark mode by default, rename config option to `darkMode`

* Rebuild fixtures
2020-10-20 21:36:05 -04:00
Adam Wathan
7376d7c8b1 Enable dark mode 2020-10-18 15:43:50 -04:00
Adam Wathan
9d40ef519c Remove default values from config that have default values even when not present at all 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
038afedfac
Merge plugins when resolving config (#2561) 2020-10-14 12:45:59 -04:00
Adam Wathan
ac82484dd9
Don't import corePlugins in resolveConfig (#2548) 2020-10-13 08:14:57 -04:00
Adam Wathan
b299b6fbe1
Support new presets key + extending core plugins config (#2474)
* WIP

* Support array for Tailwind config

* Drop array format for `presets` key instead

* Update changelog
2020-10-08 11:21:39 -04:00
Adam Wathan
476950ce40
Support defining variants as functions for easier extending (#2309)
* Support defining variants as functions for easier extending

* Fix style

* Remove commented code

* Add 'without' helper to variant function API

* Update changelog
2020-09-04 10:59:02 -04:00
Adam Wathan
038b158e28 Add max-w-screen-{breakpoint} utilities 2019-12-27 08:53:47 -05:00
Adam Wathan
26337bc39f Add new plugin and plugin.withOptions functions for creating plugins 2019-12-20 10:53:27 -05:00
Adam Wathan
311fc66410 Merge changes from 1.1.3 and fix conflicts 2019-10-22 13:04:46 -04:00
Adam Wathan
e3576242a4 Ensure all function properties receive config utils 2019-10-22 12:59:42 -04:00
Adam Wathan
5911bd704c Reverse extend array to guarantee correct precedence 2019-10-13 20:31:32 -04:00
Adam Wathan
53dff626a7 Fix style 2019-10-12 13:41:28 -04:00
Adam Wathan
65d45689ae Allow plugins to provide their own config object 2019-10-12 13:40:00 -04:00
Adam Wathan
33e5546e9b Fix style 2019-10-12 13:05:08 -04:00
Adam Wathan
4c25ca5ed6 Apply config modifications to default config, before resolving config 2019-10-12 13:05:08 -04:00
Adam Wathan
eb24d5067c Fix style 2019-10-12 12:53:32 -04:00
Adam Wathan
e7b831fc09 Allow resolving an arbitrary number of stacked config files 2019-10-12 10:24:01 -04:00
Adam Wathan
b91f0ef628 Ignore values not parseable by reduce-css-calc 2019-08-09 16:10:41 -04:00
Adam Wathan
25b3aba7d7 Use reduce-css-calc to avoid inspecting value to negate 2019-08-06 07:42:38 -04:00
Ari Seyhun
d3675ebd23 Add support for negative calc values 2019-08-01 13:32:10 +09:30
Ari Seyhun
c3075d97fe Add support for negative css custom properties 2019-08-01 12:57:46 +09:30
Adam Wathan
0183b86b45 Fix global variants not working when configs are merged 2019-05-13 12:44:19 -04:00
Jarek Radosz
23b720bb31 Allow accessing deep paths with function values via theme helper
Example:

```js
theme: {
  spacing: {
    '0': '0',
  },
  width: theme => ({
    ...theme('spacing'),
    '1/3': '33.33333%',
  }),
  minWidth: theme => ({
    '1/3': theme('width.1/3'),
  }),
}
```
2019-05-08 22:11:10 +02:00
Adam Wathan
aac25d6a7a Fix bug where config utils was not passed through to nested closures 2019-04-27 16:55:21 -04:00
Adam Wathan
c6ae957aff Support negative values for inset 2019-04-24 16:37:13 -04:00
Adam Wathan
e8b64fdb62 Move negative margin logic into a helper
Adds a new `utils` bucket that's passed as a second arg when using a closure for theme values. The idea is you can destructure useful helper functions out of this argument, in this case a `negative` function that converts a positive scale to negative values. That's the only helper function right now, but making it a destructurable arg so we can add more if necessary without adding a bunch of positional arguments.
2019-04-24 15:15:30 -04:00
Brad Cornes
caa687a59b account for function values in theme function 2019-03-24 20:10:15 +00:00
Adam Wathan
f5e8c74639 Don't mutate variants in user's config 2019-03-22 13:13:39 -04:00
Adam Wathan
7e1113561a Don't mutate the user's config when resolving 2019-03-22 12:47:21 -04:00
Adam Wathan
aee1e44431 Fix code style 2019-03-18 11:42:56 -04:00
Adam Wathan
509b698bfc Simplify resolveConfig slightly, try to catch more in tests 2019-03-18 11:21:32 -04:00
Jarek Radosz
62972a7693 Lazily evaluate values in the extend section
In a way this combines PRs #655 and #774.
2019-03-17 05:31:35 +01:00
Adam Wathan
fcd0f364db Pass theme to closures as function instead of object 2019-03-16 16:22:31 -04: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