Package Exports
- laravel-mix-ejs
- laravel-mix-ejs/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (laravel-mix-ejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Laravel Mix EJS

This extention provides a method to compile EJS templates.
Usage
First, install the extension.
npm install laravel-mix-ejs@next --save-dev
Then, require it within your webpack.mix.js
file, like so:
let mix = require('laravel-mix')
require('laravel-mix-ejs')
mix
.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.ejs('resources/views', 'public')
And you're done!
Data
With the 3rd argument, it is possible to inject variables used in templates.
mix.ejs(
'resources/views',
'public',
{ foo: 'bar' }
)
Options
With the 4th argument, it is possible to set options for EJS.
mix.ejs(
'resources/views',
'public',
{ foo: 'bar' },
{ rmWhitespace: true }
)
You can also set the following extra options in it.
base
This option keeps a hierarchical structure (like Gulp).
mix.ejs(
'resources/views',
'public',
{ foo: 'bar' },
{ base: 'resources/views' }
)
ext
This option changes the output file extension.
mix.ejs(
'resources/views',
'public',
{ foo: 'bar' },
{ ext: '.php' }
)
partials
Paths set to this option will be watched but not compiled.
mix.ejs(
'resources/views',
'public',
{ foo: 'bar' },
{ partials: 'resources/views/partials' }
)