MixAssets

Mix assets using Laravel Mix for Node.js compilation and processing.

 class System\Classes\MixAssets

This works similar to the System\Classes\CombineAssets class in that it allows modules, plugins and themes to register configurations that will be passed on to Laravel Mix and Node.js for compilation and processing.

Traits

Trait Description
Singleton

Singleton trait.

Properties

protected static $callbacks : array

Registered callbacks.

protected $mixJs : string

The filename that stores the Laravel Mix configuration

protected $packageJson : string

The filename that stores the package definition.

protected $packages : array

A list of packages registered for mixing.

Methods

public fireCallbacks () : void

Calls the deferred callbacks.

Returns
void

public getPackageCount () : int

Returns the count of packages registered.

Returns
int

public getPackages () : array

Returns all packages registered.

Returns
array

public init () : void

Constructor.

Returns
void

public static registerCallback (callable $callback) : void

Registers a callback for processing.

Parameters
Property Description
$callback
callable
Returns
void

public registerPackage (string $name, string $path) : void

Registers an entity as a package for mixing.

Entities can include plugins, components, themes, modules and much more.

The name of the package is an alias that can be used to reference this package in other methods within this class.

By default, the MixAssets class will look for a package.json file for Node dependencies, and a winter.mix.js file for the Laravel Mix configuration

Parameters
Property Description
$name
string

The name of the package being registered

$path
string

The path to the Mix JS configuration file. If there is a related package.json file then it is required to be present in the same directory as the winter.mix.js file

Returns
void

protected isPackageIgnored (string $packagePath) : bool

Check if the provided package is ignored.

Parameters
Property Description
$packagePath
string
Returns
bool

public __clone ()

Inherited from Singleton
Returns
mixed

public __wakeup ()

Inherited from Singleton
Returns
mixed

public static final forgetInstance ($container = null) : void

Inherited from Singleton

Forget this singleton's instance if it exists

Parameters
Property Description
$container
mixed
Returns
void

public static final instance ($container = null) : static

Inherited from Singleton

Create a new instance of this singleton.

Parameters
Property Description
$container
mixed
Returns
static

protected final __construct ()

Inherited from Singleton

Constructor.

Returns
mixed
Copyright © 2024 Winter CMS