Skip to content

Instantly share code, notes, and snippets.

@andrewdelprete
Last active April 15, 2017 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewdelprete/c9542043a0c5bb34388920d5eca74dd4 to your computer and use it in GitHub Desktop.
Save andrewdelprete/c9542043a0c5bb34388920d5eca74dd4 to your computer and use it in GitHub Desktop.
// app/Http/Middleware/AssetUrls.js
// Middleware 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