As a designer I am totally new to magento 2 file structure and preprocessing.

As far as my understanding is correct, magento uses less files and uses gruntfile.js for preprocessing so that via livereload extension we can runtime compile our _extend.less file.

I had confgured gruntfile for this and after these commands what I get is four files in pub/static/frontend/vendorname/customthemename/en_us/css/ directory that were not before grunt configuration.

  1. style-l.less
  2. style-m.less
  3. email.less
  4. email-inline.less

Now inside app/design/frontend/vendorname/customthemename/css/web/css/source directory I have my own _extend.less file for extending default magento library variables,mixins etc.

Currently there are two questions in my mind.

Now as grunt needs this root source files in pub directory for prepeocessing, what if I accidently run any developer command for magento.

Is it that I will lose this structure or that by putting any .less (imported via _extend.less) file in app folder will manage this?

grunt clean:theme command clean all content inside pub/static/frontend/vendorname/customthemename/en_us. How to not lose those all after configuring grunt? Now I am little worried about losing any static content after configuring grunt.

Second question is that to install grunt, I have to install all node modules via command npm install. Now that I have done all process in my local pc, this is fine but how to do the same (i.e. install all node modules) for grunt in server?

  • have you installed Node.js in server ? Commented Apr 26, 2018 at 10:49
  • No.I want to know the process for that if we install it like we do locally through command or anything else? Commented Apr 26, 2018 at 11:14
  • You should install first Node.js then run npm install Commented Apr 26, 2018 at 11:17
  • For local enviornment, I have downloaded the windows setup. Is it same procedure for server? Commented Apr 26, 2018 at 11:19
  • No, I think your server was linux Commented Apr 26, 2018 at 11:26

1 Answer 1


You will not lose your css in pub/static folder if you have used app/design/frontend/vendorname/customthemename/css/web/css/source/_extend.less for front end changes

Magento will regenerate all css in pub/static from your theme less file when you run php bin/magento setup:static-content:deploy and if you are using grunt then use grunt exec:themename (specified in dev/tools/grunt/configs/theme.js) and use grunt less:themename to regenerate css from your theme less file(_extend.less)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.