Skip to content
Permalink
Browse files

Guides: add examples for `javascript` and `stylesheet` helpers to be …

…used with a Hash to specify HTML attributes.
  • Loading branch information...
jodosha committed Jul 20, 2016
1 parent 0009b8a commit fb680fdf698b1dd1343dc1b2760543e796f38682
Showing with 20 additions and 0 deletions.
  1. +20 −0 source/guides/helpers/assets.md
@@ -38,6 +38,16 @@ A source can be the file name without the extension, or an absolute URL.
<script src="/assets/application.js" type="text/javascript"></script>
```

Alternatively, it accepts **only one** source and a Hash to represent HTML attributes.

```erb
<%= javascript 'application', async: true %>
```

```html
<script src="/assets/application.js" type="text/javascript" async="true"></script>
```

### `stylesheet`

It generates a `<link>` tag for the given source(s).
@@ -53,6 +63,16 @@ A source can be the file name without the extension, or an absolute URL.
<link href="/assets/main.css" type="text/css" rel="stylesheet">
```

Alternatively, it accepts **only one** source and a Hash to represent HTML attributes.

```erb
<%= stylesheet 'application', crossorigin: 'anonymous' %>
```

```html
<link href="/assets/application.css" type="text/css" rel="stylesheet" crossorigin="anonymous">
```

### `favicon`

It generates a `<link>` tag for the application favicon.

0 comments on commit fb680fd

Please sign in to comment.
You can’t perform that action at this time.