Webpack is a module bundler. Webpack takes modules with dependencies and generates static assets representing those modules.
The main interest of using Webpack is that it will compile all your styles - which we advise you to write using Sass - into a single CSS file. This way, your theme will make only one HTTP request for this single file, and since your browser will cache it for later re-use, it will even donwload this file only once.
Webpack is not at all required by PrestaShop, you are free to use your favorite tool! The documentation explains Webpack since it’s the tool we chose for the Classic theme, and StarterTheme ships with a ready-to-use configuration file.
If you want to compile your assets using Webpack (and we advise you to), follow these steps:
npm run build.
npm run watch.
The Webpack configuration file for StarterTheme is thus:
It provides proper configuration for compile your Sass, Less, Stylus or CSS files into a single CSS file.
If you want to use Stylus or Less, simply edit the command line under the “scripts” section.