How To Write JS and CSS in WordPress with Industry Standard Tools

| 13-8-2022 | WordPress

When you create a WordPress Theme or a Plugin, you can write plain Javascript and CSS the old way. But the industry standard today is to use a “build tool”, which creates a single JS (or CSS) file dynamically, which is the only one you have to “include” on every web page (single-page application (SPA)).

Fortunately, WordPress offers @wordpress/scripts, a great tool (based on Webpack) with all software you need for this purpose.

It is recommended to write Object Oriented Javascript using ES6 modules. Also, use SCSS and modules in your CSS.

Read the original article here