25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Reading from the CDN<br />

We now want <strong>Vue</strong>bnb to load any static assets from the CDN instead of the web<br />

server when in production. To do this, we're going to create our own <strong>Laravel</strong><br />

helper method.<br />

Currently, we reference assets in our app using the asset helper. This helper<br />

returns a fully-qualified URL for that asset's location on the web server. For<br />

example, in our app view we link to the JavaScript bundle file like this: <br />

Our new helper, which we'll call cdn, will instead return a URL that points to the<br />

asset's location on the CDN:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!