Folder structure
After creation, your project should look like this:
As you may have noticed, the src
and public
folders are empty. Why so?
Important files and folders
Any ScandiPWA application must include following files:
File name
Intended purpose
src/index.js
The JavaScript entry point
public/index.html
The page template
In case of your project, the src/index.js
and public/index.html
are located in your parent theme. You may however create these files in your theme, then, they will be preferences over the parent theme defined files.
You may create subdirectories inside src
. For faster rebuilds, only files inside src
are processed by Webpack. You need to put all JS and CSS files inside src
folder, otherwise Webpack wonβt see them.
You can, however, create more top-level directories. They will not be included in the production build so you can use them for things like documentation.
There are some ScandiPWA extensions, which might define new required files. In example, there is an extension@scandipwa/m2-theme
which allows to compile into Magento 2 theme. It defines a new PHP page template:
File name
Intended purpose
src/index.php
The Magento 2 theme's root.phtml
template
You may re-define this template in your theme. However, by default the src/index.php
will be provided by @scandipwa/m2-theme
extension.
Working with files
ScandiPWA introduces the concept of "overriding" files.
Last updated
Was this helpful?