Skip to content

support running tailwindcss cli with npx @tailwindcss/cli #13821

@scratchmex

Description

@scratchmex

in the case of tailwindcss, even tho the cli has that name, the package is actually @tailwindcss/cli so running npx tailwindcss doesn't make sense. the proposal is to add an special case where it actually runs npx --no-install @tailwindcss/cli <args> whenever we call exec.Npx. this will allow to use tailwindcss without any prior setup (apart from having npx)

the objective of this change is to avoid needing to install tailwindcss cli globally, nor having a npm/js project setup under hugo (defeats the purpose of the standalone tailwindcss cli)

change should be in this function

hugo/common/hexec/exec.go

Lines 176 to 177 in 7624176

// If name is "tailwindcss", we will try the PATH as the second option.
func (e *Exec) Npx(name string, arg ...any) (Runner, error) {

particulary adding a new exception here

hugo/common/hexec/exec.go

Lines 215 to 218 in 7624176

if name == "tailwindcss" {
// See https://github.com/gohugoio/hugo/issues/13221#issuecomment-2574801253
locations = []binaryLocation{binaryLocationNodeModules, binaryLocationPath, binaryLocationNpx}
}

I am open to do the PR after the heads up

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions