Concatenate the source files of a project
npm install sourcecat
|2||downloads in the last week|
|10||downloads in the last month|
|Version||0.2.0 last updated 4 months ago|
A simple tool for concatenating source files in a repository in some kind
of logical fashion. Files are concatenated in alphabetical order (with
the exception of
index.js trumping other files in a folder) breadth
first through the folder structure.
Specify the glob pattern as the first arg, that's all you can do. If none is
specified, then code me will look to find all of the
.js files from your
current working directory down, excluding a few directories along the way
Because I like using emu for
generating my documentation, and using
sourcecat I can put things in a
mostly sensible order:
sourcecat | emu > README.md
In the following cases, the behaviour of the
sourcecat command changes:
src/folder is detected in the current working directory. In this case, the top-level directory is skipped and only the
src/directory is traversed.
Tips and Tricks
You can import a file in the sourcecat tree at a custom location by using
@import line, e.g:
An example of this can be found in the tests.
Combine the input files (as read from the
sourcecat.load function) into
a single output file.
From the current working directory, load the files matching the specified pattern and send the resulting data to the callback as an array of data objects (with a filename and content attribute).