For CSS, I found that we can add web/i18n/en_US/mymodule.css for module
If I want to add some locale specific CSS for the core module, where should I put them in? e.g. app/design/frontend/mypackage/mytheme/Magento_Catalog/web/i18n/en_US/catalog.css ?
But if I want to add locale specific .less file, how can I do this?
-
Please check this answer https://magento.stackexchange.com/a/96080/60973situee– situee2017年11月29日 08:09:42 +00:00Commented Nov 29, 2017 at 8:09
-
You must override a the less file you can’t with cssMohamed El Mrabet– Mohamed El Mrabet2017年11月29日 08:48:31 +00:00Commented Nov 29, 2017 at 8:48
3 Answers 3
You can add new CSS to the head of all your template pages.
Create /Magento_Theme/layout/default_head_blocks.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/custom.less" />
</head>
</page>
Simple ways to customize a theme's styles for magento2
Simplest way to extend parent styles
To extend the parent theme’s styles in your theme:
In your theme directory, create a web/css/source sub-directory. Create a _extend.less file there. The path to it looks like following: <theme_dir>/ │ ├── web/ │ │ ├── css/ │ │ │ ├── source/ │ │ │ ├──_extend.less
for locale specific less, use this path
<theme_dir>/web/i18n/locale/css/source/_extend.less
locale-specific not possible.
for locale assign you must need to assign store view.
For each store wise you can create new theme and assig it.
Hope it will clear your idea.
-
This isn't true. You can do locale specific styles and all other static content (images, js, css, fonts, ...) just by placing the files as @situee explained.Zankar– Zankar2022年03月14日 11:40:17 +00:00Commented Mar 14, 2022 at 11:40