Extensions
The project introduces the concept of "extensions".
For NPM package to be considered an extension, it must have a package.json
field scandipwa.type
equal to extension
. For example:
The extensions are power-less without a theme. The application compiles from a theme sources. Extensions are just an isolated pieces, which make some features of your application work.
Registering an extension
Both themes and extensions can register extensions. In order to do it, the extension should be added to scandipwa.extensions
object of package.json
. The extension must be a valid NPM package, therefore you are required to add it into dependencies
field of your package.json
. Like so:
In order to create new extension, use following command:
Enabling an extension
Enabling and disabling an extension is achieved by setting the true
or false
as a value of the extension key in scandipwa.extensions
. Your theme can control enabled extensions across the whole application. This allows to disable the previously enabled extension. The sequence of preference in this case is:
Your theme enabled extensions
Your theme's parent themes enabled extensions
Extension enabled extensions
Watch out!
Disabling a previously enabled extension can lead to layout-shifts and issues inside of your parent theme. Also, there might be extensions plugging into the extension you intend to disable, this can lead to unexpected results.
Extension features
Extensions are very important and powerful part of ScandiPWA tool-chain. Following feature are available:
Following features are upcoming in next versions of Create ScandiPWA App releases:
Translation bundles
HTML template plugin
Last updated
Was this helpful?