Closed VIVEKLUCKY249 closed 7 years ago
@VIVEKLUCKY249 When deploying static content, Magento may ignore the assets of custom theme if the assets files(css, js) under web were empty. So, we need to put some css or js files under this folder.
Unfortunately, I could not reproduce the issue as you described it on 2.1.3 version. Do you have an ability to verify this bug on 2.1.3 Magento version? If not - we recommend to upgrade to latest Magento version (2.1.3), where this issue is not reproducible
If can - please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result. Your cusotm CSS/LESS files, Screenshots, Theme configuration would be helpful, too.
Unfortunately, I could not reproduce the issue as you described it on 2.1.3 version.
pub
directoryStores > Configuration > Advanced > Developer > CSS Settings
settings:
Merge CSS Files => No
Minify CSS Files => Nodeveloper
or default
mode.Create Test theme
app/design/frontend/TestNamespace/theme_dir
app/design/frontend/TestNamespace/theme_dir/registration.php
<?php
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/TestNamespace/theme_dir', DIR);
3. Add `app/design/frontend/TestNamespace/theme_dir/theme.xml`
```xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Test Theme</title>
<parent>Magento/luma</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
app/design/frontend/TestNamespace/theme_dir/media/preview.jpg
(can be copied from luma
theme)app/design/frontend/TestNamespace/theme_dir/Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<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/source/custom-css-file.css"/>
</head>
</page>
app/design/frontend/TestNamespace/theme_dir/web/css/source/custom-css-file.css
/** custom css file test */
footer * {
color: red !important;
}
app/design/frontend/TestNamespace/theme_dir/Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<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/source/custom-css-file.css"/>
<css src="css/source/custom-less-file.css"/>
</head>
</page>
app/design/frontend/TestNamespace/theme_dir/web/css/source/custom-less-file.less
/** custom less file test */
@fontColor: red;
.page-header .panel.wrapper, .page-header .panel.wrapper * {
color: @fontColor !important;
}
If the system does not find the included CSS files, it searches for the same file names with a .less extension.
app/design/frontend/TestNamespace/theme_dir/web/css/source/_theme.less
/** override parent styles test */
@color-gray-middle3: yellow;
app/design/frontend/TestNamespace/theme_dir/web/css/source/_extend.less
/** extend parent styles test */
@import '_test-import.less';
app/design/frontend/TestNamespace/theme_dir/web/css/source/_test-import.less
/** import styles test */
@headerFontSize: 72px;
@headerFontColor: navy;
h1 {
font-size: @headerFontSize !important;
color: @headerFontColor !important;
}
production
modeIf your style changes do not apply after refreshing the page, cleaning the static files cache might help. See the Clean static files cache topic for instructions how to do this.
Create a storefront theme Simple ways to customize a theme's styles Cascading style sheets (CSS) Include CSS Apply and configure a storefront theme
pub/static
, var
directoriesStores > Configuration > Advanced > Developer > CSS Settings
settingsCONTENT > Design > Configuration
dataPlease add more details to your description of the steps you followed when identifying this issue. Screenshots or logs would be helpful, too. Thanks in advance
I have installed Magento CE 2.1.2 in my local system Windows 7(64 bit) Uwamp.
Now I have created my custom theme and set it up in the backend. Below are the theme specific files and I have kept some folders like
web/css/source
,web/fonts
,web/images
etc. empty, as I want those files to be called directly from parent theme.C:\UwAmp\www\testmage212\app\design\frontend\Vivek\Custom\registration.php:
C:\UwAmp\www\testmage212\app\design\frontend\Vivek\Custom\theme.xml:
C:\UwAmp\www\testmage212\app\design\frontend\Vivek\Custom\Magento_Theme\layout\default_head_blocks.xml:
and
C:\UwAmp\www\testmage212\app\design\frontend\Vivek\Custom\media\preview.jpg
which is copied from Luma Theme.
After setting this same theme from backend, everything else works fine with new theme on frontend, but some css & js files are not being called from the parent theme, which results in icons and logo not displaying at all in frontend Homepage, Product Listing page etc. Also the "Hot Sellers" products block from Homepage disappeared.
Any hints on what could be the issue and how to resolve this ?