Skip to content

Instantly share code, notes, and snippets.

@allanfreitas
Forked from andrewdelprete/AssetUrls.js
Created April 15, 2017 16:16
Show Gist options
  • Select an option

  • Save allanfreitas/8425b2e787d2b1303e03911d3f69ed62 to your computer and use it in GitHub Desktop.

Select an option

Save allanfreitas/8425b2e787d2b1303e03911d3f69ed62 to your computer and use it in GitHub Desktop.
// app/Http/Middleware/AssetUrls.js
// Middle where to load mix-manifest.json
// file Laravel Mix generates
class AssetUrls {
* handle (request, response, next) {
const View = use('View')
View.global('assetUrls', function () {
return require('../../../public/mix-manifest.json')
})
yield next
}
}
module.exports = AssetUrls
<html>
<head>
<link href="{{ assetUrls()['/css/admin.css'] }}" rel='stylesheet' type='text/css'>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment