Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support renaming of output files by PostCSS plugin. #9944

Merged

Conversation

NakajimaTakuya
Copy link
Contributor

@NakajimaTakuya NakajimaTakuya commented Nov 28, 2022

If you use tailwindcss as a cli and set the postcss option, the output file will ignore changes to result.opts by the postcss plugin and respect the output option passed to the cli.

However, some postcss plugins, such as the cache buster plugins, work by rewriting result.opts.
Like this one, for example.
https://github.com/keithamus/postcss-hash/blob/v2.0.0/index.js#L55-L57

This change is to honor the end product, result.opts.to, as the output file during postcss adaptation.

Example of reproducing the current problem.

// commands.
tailwindcss -i /path/to/input.css -o /path/to/output.css --postcss postcss.config.js


// postcss.config.js
module.exports = {
  plugins: [
    require('postcss-hash')({manifest: './manifest.json'})
  ]
}

// expected: outputfile: /path/to/output.a1b2c3d4e5.css
// actual: outputfile: /path/to/output.css

@RobinMalfait RobinMalfait changed the title Support for rename of output files by postcss plugin. Support renaming of output files by PostCSS plugin. Nov 29, 2022
@RobinMalfait RobinMalfait merged commit 705d213 into tailwindlabs:master Nov 29, 2022
@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

Nice and simple, thanks!

@NakajimaTakuya
Copy link
Contributor Author

@RobinMalfait
Thank you, I'm very happy❤️

@NakajimaTakuya NakajimaTakuya deleted the apply/postcss-result_opts branch November 29, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants