Open Eddcapone opened 2 years ago
Hi @Eddcapone. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, review the Magento Contributor Assistant documentation.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
styles in module you will not get ability to use some default value than theme. From my experiences, current some value/variables can't call from module scope less. Write styles from module or theme not have much differences. Magento wrap all styles into final css output
@mrtuvn Then how can I solve it? It looks like a magento bug to me.
Just curious why not to use in theme scope/area in app/design
You can try this approach (but this is custom module) not default function of magento https://github.com/swissup/module-rtl#less-mixins
Just curious why not to use in theme scope/area in app/design
Because it is only needed for the extension. If the extension is not active e.g. because it is only enabled for a certain store view, then the style is not needed. If I would put it in the theme, then it would load all the time.
Oke make more senses to me!
In your specific case you can import mixins in your module like this
_module.less
@import (reference) '_mixins';
// Other styles
_mixins you can use syntax like https://github.com/magento/magento2/blob/2.4-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less
@abs-yourmixins-name: {
//Any code less/css here
};
.h1() {
// Any code less/css here
}
From my experiences from module scope (app/code/ or vendor/magento/ v.v) you only use variables from magento lib/web/css You can't get variables/mixins define in app/design
From my experiences from module scope (app/code/ or vendor/magento/ v.v) you only use variables from magento lib/web/css You can't get variables/mixins define in app/design
Thats not true. I just tested it and it works. I defined a mixin in my theme and used it in the module successfully.
It just does not work if you create another theme which is a child theme of your first theme like described in my bug report.
current my client used v2.3.3. I can't call mixins defined in child theme from module app/code. Got issue mixin undefined I don't have instance test in higher version for re-test this case
Hello @Eddcapone,
We have tried to reproduce this issue on latest 2.4-develop branch but unable to reproduce and below are the steps which i have https://github.com/magento/magento2/issues/35684.
Please find the attached screen for your reference.
Please provide more information for this issue so that we can reproduce.
Thanks
Hi @engcom-Echo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.Issue: Clear Description
label to the issue by yourself.Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Hello @engcom-Echo, please upload the code you were using for your test as a .zip so I can have a look and compare with mine.
Can you share sample of your ? @Eddcapone
@mrtuvn Yes, here is my code:
issue_35684.zip (extract to root dir of the magento project)
@engcom-Echo , I forgot to add this step to the description, can you please check if the module is enabled?
3.4 Enable Module "Company_Test" php bin/magento module:enable Company_Test
I also added my compilation output.
@Eddcapone,
Thanks for sharing more information. we have tried to reproduce this issue on 2.4-develop branch and now it is reproducible and below are the steps which i have follow #35684
my code zip file. Issue35684.zip(extract to root dir of the magento project)
Please find the attached screen for your reference.
Hence, the issue reported is reproducible and confirmed.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6021 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Echo. Thank you for verifying the issue.
Issue Available: @engcom-Echo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
For me i also have an error that less files are not showing anymore in browser after the compile is done with: grunt clean && grunt exec && grunt less After i upgraded to 2.4.4 and used the sample Gruntfile & package.json, but then i followed this post: https://stackoverflow.com/questions/73234428/why-not-showing-less-file-path-in-browser-after-running-grunt-in-magento2 And added: "grunt-contrib-less": "~1.4.1" to my Gruntfile and it started working again and i saw less references in browser.
Preconditions and environment
Code:
issue_35684.zip (extract to root dir of the magento project)
Steps to reproduce
Overview
1. Create Theme Foo (inheriting from Magento/luma)
1.1 app/design/frontend/company/foo/registration.php
1.2 app/design/frontend/company/foo/theme.xml
1.3 app/design/frontend/company/foo/web/css/source/_extend.less
@import '_mixin.less';
1.4 app/design/frontend/company/foo/web/css/source/_mixin.less
2. Create Theme Bar (inheriting from Foo)
2.1 app/design/frontend/company/bar/registration.php
2.2 app/design/frontend/company/bar/theme.xml
2.3 app/design/frontend/company/bar/web/css/source/_extend.less
@import '_text.less';
2.4 app/design/frontend/company/bar/web/css/source/_text.less
.black { color: black; }
3. Create Module Company_Test
3.1 app/code/Company/Test/registration.php
3.2 app/code/Company/Test/etc/module.xml
3.3 app/code/Company/Test/view/frontend/web/css/source/_module.less
3.4 Enable Module "Company_Test"
4. Setup Upgrade
5. Grunt Configuration
dev/tools/grunt/configs/local-themes.js
6. Grunt Refresh
Run
grunt refresh
Expected result
It should compile without an error.
Actual result
-> .h1 is undefined
Additional information
If I skip 2.3 and 2.4 then compilation works.
Release note
No response
Triage and priority