Skip to content

Commit

Permalink
Improve Readme.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 28, 2014
1 parent dac5820 commit 38af36b
Showing 1 changed file with 45 additions and 34 deletions.
79 changes: 45 additions & 34 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,69 @@
[![Build Status](https://secure.travis-ci.org/GoalSmashers/assets-expander.png)](https://travis-ci.org/GoalSmashers/assets-expander)
[![Dependency Status](https://david-dm.org/GoalSmashers/assets-expander.png?theme=shields.io)](https://david-dm.org/GoalSmashers/assets-expander)
[![devDependency Status](https://david-dm.org/GoalSmashers/assets-expander/dev-status.png?theme=shields.io)](https://david-dm.org/GoalSmashers/assets-expander#info=devDependencies)
## What is assets-expander? ##

Assets-expander is a node.js library that turns a glob-like declarations from YAML file into a list of files.
## What is assets-expander?

Assets-expander is a Node.js library that turns a glob-like declarations from YAML file into a list of files.
Just see below for examples.

## Usage ##
## Usage

### How to install assets-expander? ###
### How to install assets-expander?

npm install assets-expander
```
npm install assets-expander
```

### How to user assets-expander? ###
### How to user assets-expander?

var AssetsExpander = require('assets-expander');
var expander = new AssetsExpander('assets.yml', { root: 'path/to/public/dir' });
expander.processGroup('javascripts', 'public') // gets a flat list of assets in public group
```js
var AssetsExpander = require('assets-expander');
var expander = new AssetsExpander('assets.yml', { root: 'path/to/public/dir' });
expander.processGroup('javascripts', 'public'); // gets a flat list of assets in public group
```

### How to define assets.yml file? ###
### How to define assets.yml file?

Just go with something like:

javascripts:
public:
vendor: 'undescore,modernizr'
public: '**/*'
stylesheets:
public:
- 'reset,shared,base,home'
```yml
javascripts:
public:
vendor: 'undescore,modernizr'
public: '**/*'
stylesheets:
public:
- 'reset,shared,base,home'
```
Then if you have the following directory structure:
javascripts
- vendor
- underscore.js
- modernizr.js
- public
- main.js
- fallback.js
stylesheets
- reset.css
- shared.css
- base.css
- home.css
```
javascripts
- vendor
- underscore.js
- modernizr.js
- public
- main.js
- fallback.js
stylesheets
- reset.css
- shared.css
- base.css
- home.css
```
then running the following code will give you the files you need:
> expander.processGroup('stylesheets', 'public')
> ['stylesheets/reset.css', 'stylesheets/shared.css', 'stylesheets/base.css', 'stylesheets/home.css']
```
> expander.processGroup('stylesheets', 'public')
> ['stylesheets/reset.css', 'stylesheets/shared.css', 'stylesheets/base.css', 'stylesheets/home.css']

> expander.processGroup('javascripts', 'public')
> ['javascripts/vendor/underscore.js', 'javascripts/vendor/modernizr.js', 'javascripts/public/main.js', 'javascripts/public/fallback.js']
> expander.processGroup('javascripts', 'public')
> ['javascripts/vendor/underscore.js', 'javascripts/vendor/modernizr.js', 'javascripts/public/main.js', 'javascripts/public/fallback.js']
```

## License ##
## License

Assets-expander is released under the MIT license.

0 comments on commit 38af36b

Please sign in to comment.