JavascriptImporter

Importer JS Filter Class used to import referenced javascript files.

 class Winter\Storm\Parse\Assetic\Filter\JavascriptImporter
extends Assetic\Filter\BaseFilter

=include library/jquery.js; =require library/jquery.js;

(@todo Below needs fixing) =define #FOO "Bar"; console.log(#FOO);

Extends

Class Description
Assetic\Filter\BaseFilter

Properties

protected $definedVars : array

Variables defined by this script.

protected $includedFiles : array

Cache of required files.

protected $scriptFile : string

File name for the processed JS script.

protected $scriptPath : string

Location of where the processed JS script resides.

Methods

public filterDump (Assetic\Contracts\Asset\AssetInterface $asset)

Parameters
Property Description
$asset
Assetic\Contracts\Asset\AssetInterface
Returns
mixed

protected directiveDefine ($data)

Directive to define and replace variables

Parameters
Property Description
$data
mixed
Returns
mixed

protected directiveInclude ($data, boolean $required = false)

Directive to process script includes

Parameters
Property Description
$data
mixed
$required
boolean
Returns
mixed

protected directiveRequire ($data)

Directive to process mandatory script includes

Parameters
Property Description
$data
mixed
Returns
mixed

protected parse (string $content) : string

Process JS imports inside a string of JavaScript

Parameters
Property Description
$content
string

JS code to process.

Returns
string

Processed JS.

Copyright © 2024 Winter CMS