Skip to content

Commit

Permalink
Documenting more things
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya committed Nov 21, 2013
1 parent 7ea182e commit 077ab32
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Polvo uses the same resolution algorithm presented in NodeJS, so you can code
your libraries doing global or local `require`-s as you wish, like if you were
building a NodeJS app. In the end, everything will be ready for in-browser use.

> Of couse, you won't be able to use NodeJS core modules once inside the
> Of couse, you won't be able to use NodeJS core modules once inside the
Browser, such as `fs`, `process`, `cluster` and so on. The same applies to any
other module you may find - if it uses any API not available for in-browser use,
you won't be able to use it.
Expand All @@ -109,7 +109,7 @@ you won't be able to use it.
In order to not lock you up with one single packaging system, Polvo is intended
to support some of them. It's not fully functional yet but the plans are there.

> **NOTE**: As each packaging system approaches the subject in its own
> As each packaging system approaches the subject in its own
opinionated way, it may be impossible to aggregate them all in an universal way.
However its under serious study and implementation right now to check all
possibilities.
Expand Down Expand Up @@ -248,6 +248,10 @@ Project's input `src` folders, can be one or many.

Project's output `files`, at least one should be specified.

> ★ If you're using [conditional compilation](#conditional-compilation), make
sure you're aware that you can reuse the conditional [variables]((#final-notes)
to compose the output path for your files.

### Alias

It's a handy option that lets you map some `names` to specific `dirs`. These
Expand Down Expand Up @@ -398,7 +402,7 @@ var request = require('browser-request-library');
request.do_stuff([...]);
````
# Example 2 (Desktop vs Mobile)
## Example 2 (Desktop vs Mobile)
Many people choses between JQuery or Zepto depending on what target, lets check
how it'd be done easily for having hybrid builds.
Expand All @@ -425,7 +429,7 @@ $ ENV=desktop polvo -c
$ ENV=mobile polvo -c
````
# Example 3
## Example 3
You can have multiple conditions as well, many `elifs` and also a final `else`
directive, depending on your needs:
Expand All @@ -443,8 +447,6 @@ $ = require 'god-help'
$('element').do_something [...]
````
## Variables naming
In the examples above we used the var `ENV` to get around the conditionals.
Expand All @@ -467,6 +469,25 @@ $ ANIMAL=carnivore polvo -c
$ ANIMAL=herbivore polvo -c
````
## Final notes
You can use a single `polvo.yml` with multiple targets, by setting your output
file according the vars you're using for conditional compilation.
### Example
````yaml
input:
- ./src
output:
js: ./lib/app-{ENV}.js
````
When compiled with `ENV=browser polvo -c`, the `output` js file will be saved as
`./lib/app-browser.js`.
Or `./lib/app-node.js` when compiled with `ENV=node polvo -c`, and so on.
# License
Expand Down

0 comments on commit 077ab32

Please sign in to comment.