Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Apr 28, 2015
1 parent 604e1e0 commit c2298d5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,33 @@ Now, to add assets at anytime (and anywhere in your code), simply call `Bonsai:a
Bonsai::add('assets/css/example.css');
```

### Defining Dependencies
Assets may depend on other assets being loaded before them. You can easily tell Bonsai about any dependencies your asset files may have against each other by using the `dependsOn()` method.

```php
Bonsai::add('assets/css/example.css')->dependsOn('bootstrap');
Bonsai::add('assets/css/bootstrap.css', 'bootstrap');
```

The above will generate the following CSS:

```html
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="assets/css/example.css">
```

### Rendering Assets
To echo out your assets within your layout, simply use the `css()` and `js()` methods:

### Blade
#### Blade

```html
{!! $bonsai->css() !!}

{!! $bonsai->js() !!}
```

### Twig
#### Twig

```html
{{ bonsai.css()|raw }}
Expand All @@ -50,7 +66,7 @@ To echo out your assets within your layout, simply use the `css()` and `js()` me

TODO
----
- Check for dependencies (`dependsOn()` method) and load dependencies first, in order when rendering within a view.
- ~~Check for dependencies (`dependsOn()` method) and load dependencies first, in order when rendering within a view.~~
- Combine and minify assets into one cached file when in the production environment.
- ~~Add the ability to parse a bonsai.json file for assets that can be registered for use.~~

Expand Down

0 comments on commit c2298d5

Please sign in to comment.