laravel-mix-js-partial

    1.0.0 • Public • Published

    Laravel Mix JS Partials

    Software License Latest Version on NPM

    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-dev
    

    Then, 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');

    Install

    npm i laravel-mix-js-partial

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.89 kB

    Total Files

    4

    Last publish

    Collaborators

    • abhisheksatre