I am working in git workflow. I want to know how I can create symlinks to source files after changing git branch?

Let's say I have three root source files in my theme that are located as below.

app\design\frontend\Vendor\theme\web\css\styles-l.less app\design\frontend\Vendor\theme\web\css\styles-m.less app\design\frontend\Vendor\theme\web\css\custom.less

And these files import other files to make changes like below. In custom.less file I set like below.

@import (reference) 'source/lib/_lib.less';
@import 'source/_variables.less';
@import '_homepage.less';
@import '_custom_header.less';
@import '_category.less';

Now let's say if I moved to other git branch and I added or deleted some module specific less file then if I run below command

php bin/magento dev:source-theme:deploy area="frontend" --theme="Vendor/theme" css/styles-l css/styles-m css/custom

symlinks to all source files are generated in pub directory, but the module specific files are not generated.(_module.less and _widgets.less). We must run `

grunt clean:theme

grunt exec:theme

Only after that module specific file comes at pub directory. So I can safely run

grunt less:theme

But in this case I have to deploy static content again to bring js and other static files which is very time consuming. So any help will be great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.