# laravel-mix-dload

> A Laravel Mix extension for downloading files.

Latest version **1.0.0** (published 2020-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install laravel-mix-dload
pnpm add laravel-mix-dload
yarn add laravel-mix-dload
bun add laravel-mix-dload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-02-03 |
| First published | 2018-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Michael Thomas |
| Maintainers | dadamotion |
| Keywords | laravel, laravel mix, mix, download, webpack |

## Links

- npm: https://www.npmjs.com/package/laravel-mix-dload
- Repository: https://github.com/dadamotion/laravel-mix-download
- Homepage: https://github.com/dadamotion/laravel-mix-download#readme
- Issues: https://github.com/dadamotion/laravel-mix-download/issues
- npm.io page: https://npm.io/package/laravel-mix-dload

## Dependencies (1)

- [download](https://npm.io/package/download.md) ^6.2.5

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-02-03
- 0.2.0 — 2018-05-30
- 0.1.4 — 2018-04-12
- 0.1.3 — 2018-04-12
- 0.1.2 — 2018-03-29
- 0.1.1 — 2018-03-29
- 0.1.0 — 2018-03-29

## README

<p align="center">
<a href="https://www.npmjs.com/package/laravel-mix-dload"><img src="https://img.shields.io/npm/v/laravel-mix-dload.svg" alt="NPM"></a>
<a href="https://npmcharts.com/compare/laravel-mix-dload?minimal=true"><img src="https://img.shields.io/npm/dt/laravel-mix-dload.svg" alt="NPM"></a>
<a href="https://www.npmjs.com/package/laravel-mix-dload"><img src="https://img.shields.io/npm/l/laravel-mix-dload.svg" alt="NPM"></a>
</p>



# 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:

```js
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 |

---
_Source: https://npm.io/package/laravel-mix-dload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
