1.2.0 β3 #61
ampersarnie
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Whats New?
WordPress Dependency Extraction
Support for usage of
@wordpresspackages within code to allow for more native and standard usage of Gutenberg elements.Accessing Dependency Array
As outlined in the Working with your Assets page on the wiki, asset information is placed in global PHP constants from the inc/asset-settings.php file. If we have an entry point of
editor.jsin a plugin/project calledtest-pluginthat takes advantage of@wordpresspackages, a new constant will be defined.Constants with the suffix of
_DEPENDENCIESwill contant the array required.Any entrypoints and subsequent scripts without dependencies will contain an empty array.
Aliases
To aide with directory traversion within components or files we can add a number of predefined aliases that allow for easier time with referencing directories based around a common structure that we use for our projects. This means we can avoid backstepping through directories to get back to a base directory. For example we may find we have a situation where we're backstepping to get to the
componentsdirectory like this;With aliases, this can easily be replaced with the following if required;
The following are currently supported;
@Components→{project-root}/src/componentsComponents→{project-root}/src/components@Static→{project-root}/src/staticStatic→{project-root}/src/static@Utils→{project-root}/src/utilsUtils→{project-root}/src/utilsChange Log
@wordpresspackages using DependencyExtraction as a custom extension of@wordpress/dependency-extraction-webpack-pluginpackage.HTMLWebpackplugin.TemplateGeneratorplugin.assetSettingstemplate function.This discussion was created from the release 1.2.0 β3.
Beta Was this translation helpful? Give feedback.
All reactions