Skip to content

fix: Apply parent theme located in project frontend folder - #16218

Merged
mshabarov merged 4 commits into
mainfrom
parent-theme-in-frontend
Mar 15, 2023
Merged

mshabarov merged 4 commits into
mainfrom
parent-theme-in-frontend

Conversation

@mshabarov

@mshabarov mshabarov commented Mar 9, 2023 •

Copy link
Copy Markdown
Contributor

Makes styles from parent theme apply properly if the parent theme is located in the project's folder, not in the JAR.
Re-bundles if the parent theme in frontend folder has new entries in theme.json.
Adds theme.json content to stats.json if parent theme is in the frontend folder.
Adds link tag to the styles.css of the parent theme onto the page.

@github-actions

github-actions Bot commented Mar 9, 2023 •

Copy link
Copy Markdown
Contributor

Test Results

   952 files  +1     952 suites  +1   1h 0m 47s ⏱️ + 4m 57s
6 039 tests +3  6 004 ✔️ +3  35 💤 ±0  0 ❌ ±0 
6 297 runs  +3  6 255 ✔️ +3  42 💤 ±0  0 ❌ ±0 

Results for commit cbde076. ± Comparison against base commit 33ed679.

♻️ This comment has been updated with latest results.

@mshabarov
mshabarov force-pushed the parent-theme-in-frontend branch from aa9ece0 to 7275cf2 Compare March 9, 2023 21:10
@mshabarov
mshabarov marked this pull request as ready for review March 9, 2023 21:10
}

// Secondly, add a link for the project's custom theme, if it exists
// Secondly, check if a parent theme is in the project's frontend/themes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to check if it exists? Why don't we always load it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Parent theme can we in the frontend/themes or in the JAR, Flow doesn't know in advance.
This block of codes checks if the "parent": "my-parent-theme" is located in the frontend folder, and, if so, adds a link to it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens if it is in a jar? Isn't a link added to it then also?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the theme loaded from different URLs depending on where it can be found? Sounds odd but the only reason I can come up with here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What happens if it is in a jar? Isn't a link added to it then also?

Yes, the link is added also in this case. The code block for this is a few lines above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is the theme loaded from different URLs depending on where it can be found? Sounds odd but the only reason I can come up with here

Doesn't depend, this can be refactored to visit all the possible locations with a common code/method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There might be a case when the parent theme in the frontend/themes extends another parent theme in frontend/themes. For this case the tag won't be added. I have to fix it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this or another PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Better to make another PR for it IMO, because this one is already too big.

@mshabarov
mshabarov requested a review from Artur- March 13, 2023 12:07
Artur-
Artur- previously approved these changes Mar 14, 2023

@Artur- Artur- left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

much better

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mshabarov
mshabarov merged commit 7d90a94 into main Mar 15, 2023
@mshabarov
mshabarov deleted the parent-theme-in-frontend branch March 15, 2023 08:52
vaadin-bot pushed a commit that referenced this pull request Mar 15, 2023
* fix: Apply parent theme located in project frontend folder

* Clarifications in comments and info message

* extract a new method for frontend utils setup
vaadin-bot added a commit that referenced this pull request Mar 15, 2023
…CP: 24.0) (#16263)

* fix: Apply parent theme located in project frontend folder (#16218)

* fix: Apply parent theme located in project frontend folder

* Clarifications in comments and info message

* extract a new method for frontend utils setup

* fix version

---------

Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Co-authored-by: Mikhail Shabarov <mikhail@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants