4

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?

2

3 Answers 3

1

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>
2
  • how about for locale(multi-language) specific css?
    – leo
    Dec 13, 2016 at 6:18
  • If its same theme then you can use same XML if its different the add there too in XML
    – karthick
    Dec 13, 2016 at 7:17
1

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

-1

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.

1
  • 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
    Mar 14, 2022 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.