Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Add flag to disable "touch" files in favour of registering directory dependencies #162

Merged
merged 11 commits into from
Mar 26, 2021

Conversation

bradlc
Copy link
Contributor

@bradlc bradlc commented Mar 26, 2021

This PR adds a new TAILWIND_DISABLE_TOUCH env variable flag which disables the "touch file" functionality used to trigger rebuilds.

When this flag is enabled files and directories listed in the purge config are registered as dependencies using the PostCSS message system. For globs, the base directory is determined and registered as a dependency using the context-dependency message type. This is a message type supported only by postcss-loader (since v5.1.0). Directories are also registered using the dependency message to maximise compatibility with tools, namely Rollup and PostCSS CLI which already support registering directory dependencies in this way.

When not using the touch file we no longer know which files have changed when the plugin is triggered, so we need to re-run the glob each time. This adds roughly 5ms to rebuilds in an example project containing all of the Tailwind UI components.

Take a look at this issue over on the PostCSS repository for more information regarding standardisation of non-file dependency registration.

@adamwathan adamwathan merged commit a187332 into main Mar 26, 2021
@adamwathan adamwathan deleted the context-dependencies branch March 26, 2021 20:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants