Node module for asynchronous CSS file concatenation

npm install cocat
12 downloads in the last month


Node module for asynchronous CSS file concatenation. Looks for @import statements and replaces them with the actual content of the file if it exists, otherwise it just leaves the @import statement as-is.


Use it in your scripts by specifying a file

Cocat = require('cocat');
  filename: 'path_to_file.css'
}, function(err, output) {
  // ...

Or by specifying a string and a path to use instead

Cocat = require('cocat');
  content: '/* CSS GOES HERE */'
  path:    '../foo/bar/'
}, function(err, output) {
  // ...

It also works great on the command line:

Usage: cocat [options] input.css [output.css]


  -h, --help     output usage information
  -V, --version  output the version number
  -s, --save     save output to a file based on the inputfile name


$ cocat bar.css          # concats and ouputs to stdout
$ cocat -s foo.css       # concats and saves to foo.concat.css
$ cocat baz.css qux.css  # concats and saves to qux.css

Happy concatenating!

npm loves you