Magento 2:如何覆盖gallery.css?


10

我想覆盖lib/web/mage/gallery/gallery.less和一些模块文件

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

我需要覆盖它们,因为我想更改产品图库图像的样式。

如何覆盖或是否有其他方法“解决问题”?

Answers:


9

我们可以lib在自定义主题中覆盖less文件。将此文件放在文件web夹下:

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

并增加mage/gallery/galleryPROJECT/dev/tools/grunt/configs/themes.js(或PROJECT/dev/tools/grunt/configs/local-themes/themes.js为Magento的2.2),使咕噜编译它。


谢谢您的回答,但我尝试了一下,似乎没有用。我已经删除了缓存和静态文件,再次部署,但是没有用。
蒂姆先生


非常感谢!但是我读过一张agian的支票,它们只能在lib / web / css / source中使用较少的文件。你能帮我再检查一次吗?
蒂姆先生

@MrTim您应该尝试app/design/frontend/{Vendor}/{Theme}/web/css/source/lib/mage/gallery/gallery.less
Khoa TruongDinh

先谢谢了。我尝试过,在部署它时说: 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'
蒂姆先生

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.