cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Grunt installation and execution

Magento 2 Grunt installation and execution

Hi,

 

I have installed grunt for compilation of less files in my Magento 2.

I am working on production mode

After command grunt exec:<theme> e.g grunt exec:luma it deleted all files in pub/static folder and creates symlinks of less files.

In my pub/static folder we have only less files now.

After command grunt less:<theme> it recompile less files and generates css files of source files.

There are no html files in pub/static folder now.

Does grunt also creates html file symlinks in producton mode in Magento 2?

Because as I visit different pages in frontend it creates symlinks to js and html files and add it to pub/static folder.

Is this a feature of grunt only?

 

 

4 REPLIES 4

Re: Magento 2 Grunt installation and execution

When you run grunt:exec command all the symlinks will be deleted and if you want to generate symlinks for a site,

You need to run watch command

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

Using above command all the symlinks will be regenerated.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Magento 2 Grunt installation and execution

Hi,

 

Thanks for your reply.

It means after every grunt exec and grunt less command we have to deploy the static content?

If yes then what is the benefit of grunt:less except compiling the less files.

Re: Magento 2 Grunt installation and execution

If you don't want to use Grunt then how can you compile less files? So only benefits are that our less files are compiles via grunt command. So we have to follow all the required commands.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Magento 2 Grunt installation and execution

As per my knowledge magento 2 created symlinks in pub/static folder only in default and developer mode.

But in my case it is also creating in production mode.

So I am confused if it is a grunt functionality or magentos feature