Bundles assets for Laravel Mix from Laravel Modules

v0.0.5 2018-04-19 20:52 UTC

This package is auto-updated.

Last update: 2021-01-06 01:48:25 UTC


This package provides a command that generates a js and an scss file that bundles all assets provided by each of your modules.


composer require --dev balping/asset-bundler

This package is auto-discovered by Laravel, there's no need to register the provider manually.


Modules should include index.js and index.scss files. Example file structure:

  ├── Modules/
    ├── MyModule/
      ├── Resources/
        ├── assets/
          ├── js/
            ├── index.js
          ├── sass/
            ├── index.scss
      ├── npm
        ├── package.json


php artisan module:bundle-assets

generates modules.js and modules.scss files in your main assets directory that you can require in app.js and import in app.scss:

@import "modules";

Your module can have node dependencies too. If there's a package.json in the root of a module, asset bundler creates the file resources/installed-modules/package.json that requires your module's package.json as a dependency. So if you add the following to your main package.json file, all node dependencies of your modules will be required.

    "private": true,
    "scripts": {
        // ...
    "devDependencies": {
        // ...
        "installed-modules": "file:resources/installed-modules"


This library is licensed under GPLv3.