-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Handle the error properly when LESS source file is empty or having compilation error, and make the error message clear and clean. #22182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @Hailong. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@Hailong great PR, thank you. Not sure why the travis build failed, error message had nothing to do with this change, I'll trigger the build again and approve. |
Hi @josefbehr, thank you for the review.
|
Hi @Hailong ! During testing we faced the issue Problem: When LESS file is empty, compilation stops with error message Steps to reproduce:
@Hailong Is it correct message? If we add some comments to @Hailong Could you take a look, please? Thanks! |
Hi @engcom-Alfa , yes your first screenshot is the error message I want to remove with this pull request. While I think no matter there is comment in the empty file, we would get the first screenshot as I described in the issue report. |
Hi @Hailong , the error message from first screenshot occurs on branch with PR changes when Could you take a look? Thanks! |
2465a9a
to
0512158
Compare
Hi @engcom-Alfa , I have updated the code so that it prints the error message properly in both of these two cases. |
@Hailong Thank you. It seems tests have to be adapted, too. Can you do this? |
0512158
to
198ba26
Compare
…mpilation error, and make the error message clear and clean.
f1e7ce4
to
517788a
Compare
Hi @josefbehr , I have adapted the tests accordingly. |
Hi @josefbehr, thank you for the review. |
✔️ QA Passed |
@magento run all tests |
… or having compilation error, and make the error message clear and clean. #22182
Hi @Hailong, thank you for your contribution! |
Description (*)
Sometimes developer may want to put a
<css src=...
reference in the layout xml file first to get it ready, while leave an empty LESS source file (or with some comments) there to work later on.Now the
setup:static-content:deploy
command would fail and print a full callstack of exception, while the callstack doesn't really show the real problem. Moreover, the deployment is actually moving on, until it gets a PHP error that failed to open CSS file, which it should never try since its LESS source is empty already.This fix is to address such issue, print a clear error message, and to avoid the final PHP open file error. It covers the following two conditions:
Fixed Issues (if relevant)
Manual testing scenarios (*)
app/design/frontend/Magento/blank/web/css/test-empty.less
, which has NO content or just some comments.<css src="css/test-empty.css"/>
toapp/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml
setup:static-content:deploy
command to compile.Contribution checklist (*)