working with css.less on client side compilation mode and then transitioning to server side

magento.stackexchange https://magento.stackexchange.com/questions/301569

  •  30-03-2021
  •  | 
  •  

Question

I need to compile CSS.less files, however node.js is very resource-consuming which therefore cannot be used in our current hosted account. To work on themes, documentation recommends to change mode to client side compilation. Accordingly, asides node.js what do I need installed on windows 10, and how do the revisions take effect once I switch to server side compilation as I move from development mode to production mode?

Accordingly, stylesheet revisions when frontend development workflow is set to server side throws errors, and when switching to client side less compilation it also produces errors, however when switched back again to server side less compilation, the edits do "compile", even though this seems like an atrocious way to go about doing this. This is unclear exactly how the CSS is being compiled.

All I need are minor revisions to a template which should be done by inspecting elements in the browser, and then making the revisions in the less files or by adding a custom css file when needed.

Was it helpful?

Solution

Magento does recommend using client-side less compilation? Just... where did you read about it? For sure not on the official webpage of magento :)

It says few things about the compilation.

Please read: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css-preprocess.html

You don't need the node-js to do the server-side compilation.

Node.js & grunt is just a thing to speed up the development process.

Just use this

php bin/magento setup:static-content:deploy -f

You need to use the -f flag if you are in development or developer mode.

It will compile your .less files and then you need to refresh the page.

Not sure if you need to clear the cache :)

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top