You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add the ability to disable dependency extraction
Add a `dependencyExtractionEnabled` property to `Script` & `ScriptModule` constructor that will disable automatic dependency extraction if set to `false`
| filePath | string |`''`| x | x | x | optional path which can be set to autodiscover the Asset version |
27
-
| dependencies | array |`[]`| x | x | x | all defined depending handles |
28
-
| location | int | falls back to `Asset::FRONTEND`| x | x | x | depending on location of the `Asset`, it will be enqueued with different hooks |
29
-
| version | string |`null`| x | x | x | version of the given asset |
30
-
| enqueue | bool/callable |`true`| x | x | x | is the asset only registered or also enqueued |
31
-
| data | array/callable |`[]`| x || x | additional data assigned to the asset via `WP_Script::add_data` or `WP_Style::add_data`|
32
-
| filters | callable[]|`[]`| x || x | an array of `Inpsyde\Assets\OutputFilter` or callable values to manipulate the output |
33
-
| handler | string |`ScriptHandler::class`, `StyleHandler::class`, `ScriptModuleHandler::class`| x | x | x | The handler which will be used to register/enqueue the Asset |
34
-
| attributes | array |`[]`| x || x | Allows to set additional attributes to the `script`- or `link`-tag |
35
-
| media | string |`'all'`||| x | type of media for the `Style`|
36
-
| localize | array |`[]`| x ||| localized array of data attached to `Script`|
37
-
| inFooter | bool |`true`| x ||| defines if the current `Script` is printed in footer |
38
-
| inline | array |`[]`| x ||| allows you to add inline scripts to `Script`-class via `['before' => [], 'after' => []]`|
39
-
| translation | array |`[]`| x ||| Load translation for `Script`-class via `['path' => string, 'domain' => string]`|
24
+
| property | type | default |`Script`|`ScriptModule`|`Style`| description |
| filePath | string |`''`| x | x | x | optional path which can be set to autodiscover the Asset version |
27
+
| dependencies | array |`[]`| x | x | x | all defined depending handles |
28
+
| location | int | falls back to `Asset::FRONTEND`| x | x | x | depending on location of the `Asset`, it will be enqueued with different hooks |
29
+
| version | string |`null`| x | x | x | version of the given asset |
30
+
| enqueue | bool/callable |`true`| x | x | x | is the asset only registered or also enqueued |
31
+
| data | array/callable |`[]`| x || x | additional data assigned to the asset via `WP_Script::add_data` or `WP_Style::add_data`|
32
+
| filters | callable[]|`[]`| x || x | an array of `Inpsyde\Assets\OutputFilter` or callable values to manipulate the output |
33
+
| handler | string |`ScriptHandler::class`, `StyleHandler::class`, `ScriptModuleHandler::class`| x | x | x | The handler which will be used to register/enqueue the Asset |
34
+
| attributes | array |`[]`| x || x | Allows to set additional attributes to the `script`- or `link`-tag |
35
+
| media | string |`'all'`||| x | type of media for the `Style`|
36
+
| localize | array |`[]`| x ||| localized array of data attached to `Script`|
37
+
| inFooter | bool |`true`| x ||| defines if the current `Script` is printed in footer |
38
+
| inline | array |`[]`| x ||| allows you to add inline scripts to `Script`-class via `['before' => [], 'after' => []]`|
39
+
| translation | array |`[]`| x ||| Load translation for `Script`-class via `['path' => string, 'domain' => string]`|
40
+
| dependencyExtractionEnabled | bool |`true`| x | x || enable/disable automatic dependency extraction from `.asset.json` or `.asset.php` files |
40
41
41
42
## Using the public API (methods)
42
43
@@ -177,11 +178,10 @@ $style = new Style('foo', 'www.example.com/style.css');
177
178
$style->withDependencies('wp-elements');
178
179
```
179
180
180
-
#### Automatic resolving of Script dependencies with Webpack
181
+
#### Automatic resolving of dependencies with Webpack
181
182
182
-
The `Inpsyde\Assets\Script`-class has support for resolving dependencies and version which are generated
183
-
by [dependency-extraction-webpack-plugin](https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin)
184
-
.
183
+
The `Inpsyde\Assets\Script` and `Inpsyde\Assets\ScriptModule` classes have support for resolving dependencies and version which are generated
184
+
by [dependency-extraction-webpack-plugin](https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin).
185
185
186
186
This Webpack-Plugin will create an additional `{fileName}.assets.json` or `{fileName}.assets.php`-file which contains an
187
187
array of dependencies parsed out of your JavaScript-file and a version string. To use that feature you can use
0 commit comments