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
= "winter.mix.js"
The filename that stores the Laravel Mix configuration
protected
$packageJson
:
string
= "package.json"
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.
public getPackageCount () : int
Returns the count of packages registered.
public getPackages () : array
Returns all packages registered.
public init () : void
Constructor.
public static registerCallback (callable $callback) : void
Registers a callback for processing.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
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
Property | Type | Description |
---|---|---|
$name | string |
string
The name of the package being registered |
$path | string |
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 |
protected isPackageIgnored (string $packagePath) : bool
Check if the provided package is ignored.
Property | Type | Description |
---|---|---|
$packagePath | string |
string
|
public __clone ()
public __wakeup ()
public
static
final
forgetInstance ($container = null
)
: void
Forget this singleton's instance if it exists
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
public
static
final
instance ($container = null
)
: static
Create a new instance of this singleton.
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
protected final __construct ()
Constructor.