Skip to content

Commit 0960a4d

Browse files
committed
update readme
1 parent a5241b6 commit 0960a4d

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
# Laravel Asset Helper
2+
This package provides a helper to generate paths to assets on the client-side the same as in Laravel with `asset('foo.jpg')`.
23

3-
This package provides a helper to generate paths to assets on the client-side like you would in Laravel with `asset('foo.jpg')`.
4+
## Install
5+
``` bash
6+
npm install @codinglabs/laravel-asset --save
7+
```
8+
9+
Vue.js example:
10+
``` javascript
11+
import {asset} from '@codinglabs/laravel-asset'
12+
13+
window.Vue = require('vue')
14+
15+
Vue.mixin({
16+
methods: {
17+
asset: asset
18+
}
19+
})
20+
```
421

22+
## Usage
523
The package can be configured with a mix `.env` variable:
624

725
```
8-
ASSET_URL=https://mycdn.net
26+
ASSET_URL=https://foo.cloudfront.net
927
MIX_ASSET_URL="${ASSET_URL}"
1028
```
1129

@@ -15,6 +33,7 @@ Or by adding a meta tag, which is handy if the `ASSET_URL` is determined at depl
1533
<meta name="asset-url" content="{{ config('app.asset_url') }}">
1634
```
1735

36+
1837
To inject an asset into a Vuejs component, use a [dynamic prop](https://vuejs.org/v2/guide/components-props.html#Passing-Static-or-Dynamic-Props):
1938

2039
```html
@@ -24,3 +43,9 @@ To inject an asset into a Vuejs component, use a [dynamic prop](https://vuejs.or
2443
This will be prefixed with the asset URL the same as how the Laravel `asset()` helper works.
2544

2645
If you need to conditionally build against a specific environment file, take a look at [mix-env-file](https://github.com/johnwilhite/mix-env-file).
46+
47+
## About Coding Labs
48+
Coding Labs is a web app development agency based on the Gold Coast, Australia. See our open source projects [on our website](https://codinglabs.io).
49+
50+
## License
51+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

0 commit comments

Comments
 (0)