Skip to content

Instantly share code, notes, and snippets.

@ryanfitzer
Last active December 15, 2015 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanfitzer/5202101 to your computer and use it in GitHub Desktop.
Save ryanfitzer/5202101 to your computer and use it in GitHub Desktop.
CSSCat does not copy the files into a new directory before processing. The following snippet shows how to use use CSSCat's fs-helper.js in your build.js file to create a copy of the original directory.
!function() {
var path = require( 'path' )
, csscat = require( 'csscat' )
, fsh = require( 'csscat/lib/fsh' )
;
// The directory to copy (relative to this file)
var original = './';
// The base directory (relative to this file)
var dir = '../app-build';
// Resolve to absolute paths (relative to this file's directory)
original = path.resolve( __dirname, original );
dir = path.resolve( __dirname, dir );
// Delete destination directory
if ( fsh.exists( dir ) ) fsh.rm( dir );
// Copy the target directory to the destination directory
console.log( '\nCopying files to the destination directory at "' + dir + '"');
fsh.copyDir( original, dir );
// Now that the we have fresh copy, let's get busy on it
csscat.init({
dir: dir
});
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment