Rafael Corrêa Gomes

Rafael Corrêa Gomes

Magento 2 Compiling on server or client-side? (Pros and Cons)

Magento 2 Compiling on server or client-side? (Pros and Cons)

Subscribe to my newsletter and never miss my upcoming articles

What's the better way, Server or Client-side? I had this question for many time, and I after learn I forgot all points when the other developers have asked me about it. So I decided to list all on this simple list below and adding the Local Compilation too. A disclaimer, I ever use server-side compilation on the admin panel and local compilation on my local environment. ;)

You can find this configuration on Store > Configuration > Advanced > Developer > Frontend Development Workflow.

Server-Side compilation

The server-side compilation is the default choice, used for first-time compilation after setup and for production mode.

Cons:

  • Slow
  • Global recompile
  • Need to delete static files before each run

Pros:

  • No additional setup required
  • Works on the server side

Client-Side compilation

Client-side compilation with Javascript is optional and is used to quickly preview changes and debug small issues.

Cons:

  • Annoying blinking before styles compile
  • Global recompile

Pros:

  • No need for additional setup, can be switched in the Admin area
  • Fast

Local compilation

Local compilation with Node.js and Grunt task runner is an advanced mode recommended for deep customization.

Cons:

  • Requires initial setup of the local environment

Pros:

  • Fast
  • Recompiles only local changes
  • Easy to debug
  • Can be automated with watching and live to reload

I hope that this explanation helps you with your projects, I would like to know which you prefer, and why? Tell me in the comments.

 
Share this