Skip to content

Expose helper for calling Tailwind CLI #142

Closed
@willcosgrove

Description

@willcosgrove

I've run into this need a couple of times now, and I thought that this gem might be the right home for a utility like this. Basically, I am needing a way to call the tailwindcss binary to have it generate styles for me on demand. This gem is already solving the problem of getting the binary in place on the system, but it doesn't expose any way to access it externally.

At the most basic, something like this would be really helpful:

module Tailwindcss
  TAILWIND_CLI_PATH = -File.expand_path("#{Pathname.new(__dir__)}/../exe/tailwindcss")

  def self.path
    TAILWIND_CLI_PATH
  end
end

It could also possibly expose an API for calling the binary, but there are many different ways to do that, and there may not be a reasonable one-size-fits-all approach, so it may be best to just leave it at the path.

module Tailwindcss
  TAILWIND_CLI_PATH = -File.expand_path("#{Pathname.new(__dir__)}/../exe/tailwindcss")

  def self.path
    TAILWIND_CLI_PATH
  end

  def self.call(*args)
    `#{path} #{args.join(' ')}`
  end
end

This could be accomplished in a different gem, but more than likely any user of that gem would also be using this gem, and it seems non-ideal to download the binary twice. Would the maintainers of this gem be open to exposing the path of the binary like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions