Hudson Taylor
Hudson Taylor

Reputation: 1162

Clean-css NPM Command not found

I am trying to use clean-css to minify my CSS files using a simple terminal command on Mac. I have tried everything from installing an older version of clean-css like this:

npm install [email protected] --save

to installing the command line version like this:

npm install clean-css-cli --save

The installation seems to go fine, but then whenever I try to run

cleancss -o styles.min.css styles.css

I get an error saying, "command not found." Am I missing something?

Upvotes: 2

Views: 1067

Answers (1)

Armfoot
Armfoot

Reputation: 4931

If clean-css is also not in the package.json file of your project's directory, perhaps try to install it globally:

 npm install -g clean-css-cli

After installing, this should provide you the version that was installed (try in a new shell):

cleancss -v

I do not have a Mac, but I believe you will also be able to run through npm like so:

npm cleancss -v

In my case, the former presents 4.1.9 (CLI) and the latter 3.10.10 (API). More information of the version 4 division in clean-css Github.

Upvotes: 0

Related Questions