GitXplorerGitXplorer
p

include-folder

public
18 stars
4 forks
3 issues

Commits

List of commits on branch master.
Unverified
435b633f2f500171ff8654dd56a8b075e87a6612

link to folderify

pparro-it committed 9 years ago
Unverified
b0172a3423463593153b3c11c9ae702cc4589b16

changed license

pparro-it committed 9 years ago
Unverified
10f13b6c8c6ff3aa30e3cfc09952e95c25fa9cc2

Merge pull request #4 from parro-it/devel

pparro-it committed 9 years ago
Unverified
5591cbf9608d15e78f59e07dbf0e680cb35e6aa9

removed lib

pparro-it committed 9 years ago
Unverified
4a931d4abc7ebb9310b86d33da401dbad929e171

1.0.0

pparro-it committed 9 years ago
Unverified
b2a0b5687c3eab3c5d49f908a02fa80be028fd9a

switch to eslint

pparro-it committed 9 years ago

README

The README file for this repository.

include-folder

Build Status Npm module Code Climate

Expose the content of each file in a folder as an object property.

This module is browserifiable using the folderify transform

Getting Started

Install the module with: npm install include-folder --save

Then use like this:

var includeFolder = require('include-folder'),
    folder = includeFolder("./aFolder");

Supposing that the content of aFolder was the same as in the sample in test folder var will contains:

{
    file3OtherFile: 'this is file3OtherContent content',
    file1: 'this is file1 content',
    file1_1: 'this is file1_1 content'
}

Filter included files

You can filter which files to include using the filter parameter:

var includeFolder = require('include-folder'),
    folder = includeFolder("./aFolder",/^a.*/);

This only include files that start with 'a'

Filter parameters defaults to /^[^.].*$/, which include every file in the folder, except hidden ones (these that has a name starting with dot).

Preserve filenames

To prevent normalization and stripping of the extension in the result object, the preserveFilenames option can be used:

includeFolder('./www', null, { preserveFilenames: true });

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2013 Andrea Parodi

Licensed under the MIT license.