D
Deno

help

How to run tailwindcss cli with deno task?

JJox9/22/2023
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? @Deno AI Helper
DAHDeno AI Helper9/22/2023
Sure, I'd be happy to help. Could you please provide me with the question you'd like me to answer?
JJox9/22/2023
@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?
DAHDeno AI Helper9/22/2023
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:
deno run npm:<package_name> <subcommand>
deno run npm:<package_name> <subcommand>
So, for the Tailwind CSS CLI tool, you might be able to use something like:
deno run --unstable --allow-env --allow-read --allow-write npm:tailwindcss build
deno run --unstable --allow-env --allow-read --allow-write npm:tailwindcss build
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.
JJox9/22/2023
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

Looking for more? Join the community!

Recommended Posts
Deno DeployIs it possible to use only cronjobs on deno deploy?Deno cannot import mainfile by reading from package.jsondeno 1.36.0 (release, x86_64-unknown-linux-gnu) v8 11.6.189.12 typescript 5.1.6Deno LSP in a Web WorkerHas anyone come across the lsp running in a web worker? I have an online editor (Monaco) that peopleHow do you get a Deno Jupyter notebook to recognize Deno and other types in vscode?See attached screenshotModule not found when running deno runSomething weird has started happening. When I run `deno run src/main.ts` it seems as if Deno is tryesm_entry_point / extension macro; ReferenceErrorHow do I use esm_entry_point properly? I defined my extension as: ```rust extension!( ext_name,remoteAddr returning localhost on Deno DeployI saw this thread (https://discord.com/channels/684898665143206084/1055631150787334184) about gettinDeno-native Nuxt.js?The recent [The State of Web Frameworks on Deno](https://deno.com/blog/web-frameworks-on-deno) blogDeno support Fleet IDE?Hello, can the deno plug-in be used on the Fleet editor of JetBrains IDEs? Thank you.Async execution contextIs there any way I can create a global that is unique to an async operation? I would like to use thaError Deploying to Deno Deploy LODASH isEmpty.jsI am having issues deploying to deno deploy. All was well 3 days ago. Made some changes today - but need to refersh page for message each time a user from different country sends a messageHey I was going through the below deno chat app and found a bug which is the need to referesh the paAPI architecture for generic callbackHi there, I have a general question about code architecture for an API I'm doing. Basically, it listHow can I run `deno test` on all `*.spec.ts` files contains in a specific directory ?Everything is in the question, it seems very strange that we do not have a `pattern` option to speci