Skip to content
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

Fix duplicate css when enable critical path #28480

Conversation

mrtuvn
Copy link
Contributor

@mrtuvn mrtuvn commented Jun 3, 2020

Description (*)

This PR continue great works #27211 by @krzksz in latest codebase
This PR aim to bring patch fix issue css show twice. Before the fix magento place redundant link style at bottom of page before body close end

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes CSS shows up twice when Critical CSS Enabled #26498

Manual testing scenarios (*)

  1. Enable critical path css
  2. Run deploy static content + clean cache
  3. Go to homepage inspect in browser element "page-wrapper"
  4. We will see 2 file styles-l.css have style apply for that element

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 3, 2020

Hi @mrtuvn. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jun 3, 2020

@magento run all tests

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jun 3, 2020

@mrtuvn does this PR replace #27211 or what is the purpose of it?

@ihor-sviziev
Copy link
Contributor

@magento run all tests

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jun 3, 2020

@ihor-sviziev just continue works by @krzksz after long inactive
If @krzksz continue i will close mine PR

@kandy kandy requested a review from DrewML June 3, 2020 16:07
@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jun 7, 2020

@magento run all tests

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mrtuvn,
In general your changes looks good, but I have few suggestions, please review them

@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Jun 11, 2020
@ihor-sviziev ihor-sviziev added Award: bug fix Award: test coverage Auto-Tests: Covered All changes in Pull Request is covered by auto-tests labels Jun 11, 2020
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jun 11, 2020

@mrtuvn Could you also squash your changes into one or few commits in order not to have 13 merge commits?

@ihor-sviziev ihor-sviziev added the Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. label Jun 11, 2020
@mrtuvn mrtuvn force-pushed the fix-duplicate-css-when-enable-critical-path branch from b1e074b to 23192a0 Compare June 11, 2020 15:49
@mrtuvn mrtuvn requested a review from ihor-sviziev June 11, 2020 15:50
@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jun 11, 2020

@ihor-sviziev i have squashed commits and repick all to one commit. Ready for review and test

@ihor-sviziev
Copy link
Contributor

@magento run all tests

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Aug 7, 2020

@magento run Static Tests

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Aug 7, 2020

@magento run Database Compare, Functional Tests CE, Functional Tests EE, Functional Tests B2B, Integration Tests, Magento Health Index, Sample Data Tests CE, Sample Data Tests EE, Sample Data Tests B2B, Unit Tests, WebAPI Tests

@ihor-sviziev
Copy link
Contributor

@magento run Semantic Version Checker, Database Compare

@ghost ghost moved this from Pending Review to Ready for Testing in Pull Requests Dashboard Aug 9, 2020
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-7678 has been created to process this Pull Request

@engcom-Alfa engcom-Alfa moved this from Ready for Testing to Testing in Progress in Pull Requests Dashboard Aug 10, 2020
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Enable critical path CSS ( Admin -> Stores -> Configuration -> Advanced -> Developer -> Css Settings, set Use CSS critical path to Yes);
  2. Run deploy static content + clean cache;
  3. Go to homepage inspect in browser element "page-wrapper"

Before: ✖️ styles-m.css and styles-l.css styles show up multiple times in developer tools.

2020-08-10_14-23

After: ✔️ The stylesheets are only loaded once

2020-08-10_14-34

✔️ all external stylesheets are located in the same order at the end of , after inline critical CSS

screenshot_64

Also was tested on the Blank theme and with sample data.

@engcom-Alfa engcom-Alfa moved this from Testing in Progress to Extended Testing (optional) in Pull Requests Dashboard Aug 10, 2020
@engcom-Charlie engcom-Charlie added the QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) label Aug 10, 2020
@engcom-Alfa engcom-Alfa added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Aug 10, 2020
@engcom-Charlie engcom-Charlie moved this from Extended Testing (optional) to Merge in Progress in Pull Requests Dashboard Aug 10, 2020
@magento-engcom-team magento-engcom-team merged commit 78efb6e into magento:2.4-develop Aug 13, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 13, 2020

Hi @mrtuvn, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost moved this from Merge in Progress to Recently Merged in Pull Requests Dashboard Aug 13, 2020
@mrtuvn mrtuvn deleted the fix-duplicate-css-when-enable-critical-path branch August 15, 2020 02:57
@xanka
Copy link

xanka commented Jan 20, 2021

Hi @mrtuvn Did you test on production mode?

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jan 20, 2021

What problem with production that you got? This patch only available in 2.4-develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Award: test coverage Component: Theme Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Pull Requests Dashboard
  
Recently Merged
Development

Successfully merging this pull request may close these issues.

CSS shows up twice when Critical CSS Enabled
8 participants