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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thecontext-dependency
message type. This is a message type supported only bypostcss-loader
(sincev5.1.0
). Directories are also registered using thedependency
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.