Package Exports
- laravel-mix-js-partial
- laravel-mix-js-partial/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-js-partial) 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 JS Partials
This package adds a jsPartial option to Laravel Mix, which copies JS code into a partial file.
Usage
First, install the extension.
npm install laravel-mix-js-partial --save-devThen, require it within your webpack.mix.js file:
let mix = require('laravel-mix');
require('laravel-mix-js-partial');
mix.jsPartial('js/gallery.js', 'partials/gallery-js.php');
Note: If you are using setPublicPath option in your mix file then declare setPublicPath option before jsPartial option.
mix.setPublicPath('dist').jsPartial('js/gallery.js', 'partials/gallery-js.php');Examples:
// 1. A single src and output path.
mix.jsPartial('src/gallery.js', 'partials/gallery-js.php');
// 2. For additional src files that should be bundled together:
mix.jsPartial([
'src/gallery.js',
'src/nac.js'
], 'partials/gallery-js.php');
// 3. For multiple partials:
mix.jsPartial('src/gallery.js', 'partials/gallery-js.php')
.jsPartial('src/nav.js', 'partials/nav-js.php');