PrettyCSS‎ > ‎


There are many different ways you can install PrettyCSS so it best fits with your needs.
  • Global installation - Installs a binary that is usable by everyone
  • Local installation - Installs the package into a directory of your choosing
  • Library in your JS project - Lets you use the engine directly
  • Git submodules - Skip the whole "npm" thing or use as a submodule
  • Web based - Only need to get this running in a browser?


You need to install node.js first.  See their homepage for more information.

Global Installation

This installs PrettyCSS and lets you use the prettycss command-line interface right away.  It requires root permissions on a Linux machine.

sudo npm -g install PrettyCSS

Local Installation

You can do basically the same thing as a global installation by running npm in a directory of your choosing.  PrettyCSS will be downloaded and installed into ./node_modules/PrettyCSS and the binary will be in ./node_modules/.bin/prettycss.  Adding that directory to your PATH will let you run prettycss from the command line.

npm install PrettyCSS

Library in your JS Project

If you are already writing a JavaScript project, you probably already have a package.json file to let npm automatically install dependencies for you.  If not, see npm's homepage.  To get PrettyCSS downloaded, you will need to add this line in your dependencies.

"dependencies": {
"PrettyCSS": "*"

After that, a simple npm install will download and get the code for you plus install the program at ./node_modules/.bin/prettycss.

Git Submodules

Another way to get this into your codebase would be to add it as a git submodule.  In this example, we have a directory called 3rd_party to keep libraries from other people separate from our code.  Inside of there, all node modules will go into 3rd_party/node_modules so they can find each other.  Install PrettyCSS and OptionParser's git repositories as submodules by running these commands in the top level of your existing git repository.

mkdir -p 3rd_party/node_modules
git submodule add 3rd_party/node_modules/OptionParser
git submodule add 3rd_party/node_modules/PrettyCSS
git commit -m 'Adding PrettyCSS and dependent library'

For more information on working with submodules on git, I have a page on this site that may help.

The command-line version is now in 3rd_party/node_modules/PrettyCSS/bin/cli.js -- please note that it is not called "prettycss" like it would be with the other installation methods.

Web Based

Depending on your needs, you could just download bundle.js and put it into your codebase.  Alternately, you can use the Git Submodule technique or install with npm like any of the above methods.  Those all install the entire library, test suite, command-line programs and everything else.