DEV Community

Cover image for Magento 2 Compiling on server or client side? (Pros and Cons)
Rafael Corrêa Gomes
Rafael Corrêa Gomes

Posted on • Updated on • Originally published at blog.rafaelcg.com

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

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. 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 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 server side

Client-Side compilation

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

Cons:

  • Annoying blinking before styles compile
  • Global recompile

Pros:

  • No need for additional setup, can be switched in 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 local environment

Pros:

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

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

Top comments (0)