Neutered Puppy Masquerade
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

laravel-mix-dload

0.2.0 • Public • Published

NPM NPM NPM

Laravel Mix Download

This extension provides the possibility to download files for your Mix (v2.1 and up) builds.

Usage

First, install the extension.

npm install laravel-mix-dload --save-dev

Then, require it within your webpack.mix.js file, like so:

const mix = require('laravel-mix');
 
require('laravel-mix-dload');
 
mix
    .js('resources/assets/js/app.js', 'public/js')
    .less('resources/assets/less/app.less', 'public/css')
    .download({
        enabled: mix.inProduction(),
        urls: [
            {
                "url": "https://www.google-analytics.com/analytics.js",
                "dest": "./web/js/"
            },
        ],
    });

And you're done! Compile everything down with npm run prod.

Options

Only urls is required - all other options are optional. If you don't want to use the paths object you can simply define your base and templates in the url and template options from urls

Name Type Default Description
enabled boolean mix.inProduction() set to false if you don't want to download files, set to true if you always want to download files no matter the env setting.
urls array [] An array of url objects, each with a url and dest: { url: 'http://example.com/test.jpg', dest: './web/img' }
dest string '' The string where the downloaded files need to be saved this overrides the specific url destination setting

install

npm i laravel-mix-dload

Downloadsweekly downloads

57

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability