How to run tailwindcss cli with deno task?
I would like to be able to run the tailwindcss cli tool to watch and build stylesheets as per their cli docs, https://tailwindcss.com/docs/installation
But I can't see a way that I could do that with a
deno task
like a I could with an npm
script?
Is this a case where I have to add a package.json
file or is it possible to do without that?5 Replies
@Deno AI Helper
Sure, I'd be happy to help. Could you please provide me with the question you'd like me to answer?
@Deno AI Helper , I would like to be able to run the tailwindcss cli tool to watch and build stylesheets as per their cli docs, https://tailwindcss.com/docs/installation
But I can't see a way that I could do that with a deno task like a I could with an npm script?
Is this a case where I have to add a package.json file or is it possible to do without that?
Based on the documentation, it is possible to run npm scripts or CLIs using Deno. You can use the
deno run
command with the npm:
specifier to execute npm packages. However, this feature is still experimental and requires the --unstable
flag.
Here's an example of how you might run an npm package with a subcommand:
So, for the Tailwind CSS CLI tool, you might be able to use something like:
However, please note that this is a general advice and not explicitly stated in the documentation. The actual command might vary depending on the specific requirements of the Tailwind CSS CLI tool.
If you have a package.json
file in your project, deno task
can read from the "scripts"
entries in the package.json
file. You can execute these scripts with deno task <script_name>
. But remember, Deno does not respect or support any npm life cycle events like preinstall
or postinstall
—you must explicitly run the script entries you want to run.
In conclusion, while it's possible to run npm scripts or CLIs using Deno, the feature is still experimental and might not work perfectly for all npm packages. If you encounter issues, using a package.json
file might be a more reliable solution.Great, thanks!
I ended up adding
tailwindcss
in devDependencies
in a package.json
file and a tailwind
script in it that I run with deno task tailwind