Skip to content

Commit

Permalink
Updated readme to include inline variants.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakevanlan committed Apr 10, 2016
1 parent 06ac2b7 commit 33d171a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Expand Up @@ -48,7 +48,7 @@ Finally, create an `assets` directory in your project and throw all assets compi

### Markup functions

connect-assets provides three global functions named `js`, `css`, and `assetPath`. Use them in your views. They return the HTML markup needed to include the most recent version of your assets (or, the path to the asset), taking advantage of caching when available. For instance, in a [Jade template](http://jade-lang.com/), the code
connect-assets provides five global functions named `js`, `jsInline`, `css`, `cssInline` and `assetPath`. Use them in your views. They return the HTML markup needed to include the most recent version of your assets (or, the path to the asset), taking advantage of caching when available. For instance, in a [Jade template](http://jade-lang.com/), the code

```
!= css("normalize")
Expand Down Expand Up @@ -76,6 +76,20 @@ Results in:
<script src="/js/jquery-[hash].js" async></script>
```

The inline variants `jsInline` and `cssInline` write the contents straight into the tags, instead of linking. For example,

```
!= cssInline("normalize")
!= jsInline("jquery")
```

(where `!=` is Jade's syntax for running JS and displaying its output) results in the markup

```html
<style>[contents]</style>
<script>[contents]</script>
```
You can also reference image paths via the `assetPath` helper. First, you must specify the
path to your images via the `paths` option e.g:
```javascript
Expand Down

0 comments on commit 33d171a

Please sign in to comment.