10

I want to override lib/web/mage/gallery/gallery.less and some module files in

lib/web/mage/gallery/module/*.less

I need to override them because I want to change the style of product gallery images.

How to override or Are there any other way to "settle the question"?

Rafael Corrêa Gomes
13.9k15 gold badges92 silver badges190 bronze badges
asked Nov 26, 2016 at 12:50

2 Answers 2

11

We can override the less file lib in our custom theme. Put this file under web folder:

app/design/frontend/{Vendor}/{Theme}/web/mage/gallery/gallery.less

and add mage/gallery/gallery in PROJECT/dev/tools/grunt/configs/themes.js (or PROJECT/dev/tools/grunt/configs/local-themes/themes.js for magento 2.2) to make grunt compiling it as well.

Loreena
6401 gold badge6 silver badges13 bronze badges
answered Nov 26, 2016 at 13:06
9
  • Thanks you for answer, but I try it, seem it not work. I had already remove cache and static files, deploy again, It didn't work. Commented Nov 26, 2016 at 14:06
  • 1
    You should read more: magento.stackexchange.com/questions/110164/… Commented Nov 26, 2016 at 16:24
  • Thanks a lot! But I read a check it agian, They are only work with less files in lib/web/css/source. Can you please help me check again? Commented Nov 26, 2016 at 18:07
  • @MrTim you should try app/design/frontend/{Vendor}/{Theme}/web/css/source/lib/mage/gallery/gallery.less Commented Nov 28, 2016 at 7:28
  • Thanks in advanced. I had try it, when I deploy it said that: Compilation from source: /app/design/frontend/{Vendor}/{theme_name}/web/css/source/lib/mage/gallery/gallery.less Compilation from source: frontend/{Vendor}/{theme_name}/en_US/css/source/lib/mage/gallery/gallery.less Unable to get content for 'frontend/{Vendor}/{theme_name}/en_US/css/source/lib/mage/gallery/module/_variables.less' Commented Nov 28, 2016 at 9:31
2

In your custom config file for Grunt add path to gallery file: 'mage/gallery/gallery' along with 'css/styles-m' and 'css/styles-l'

answered Jul 5, 2018 at 12:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.