MasoniteFramework / masonite4

Temporary Repository for a Masonite Rewrite for Masonite 4
14 stars 3 forks source link

add Mix helper #137

Closed girardinsamuel closed 3 years ago

girardinsamuel commented 3 years ago

This PR adds a mix() helper as in Laravel to easiliy include compiled mixed assets (through webpack.mix.js) in Masonite views.

Usage

# content of mix-manifest.json
{"/resources/js/app.css": "/static/app.3247864368.css"}

mix("resources/js/app.css") => "http://localhost:8000/static/app.3247864368.css"

The root of the url is based on APP_URL or MIX_BASE_URL if specified. This can be useful if assets are served from a CDN.

# .env
MIX_BASE_URL=https://fastcdn.com

mix("resources/js/app.css") => "https://fastcdn.com/static/app.3247864368.css"