-
-
Notifications
You must be signed in to change notification settings - Fork 359
fix: CSS loading logic for production and theme dev environments #691
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
- Updated the CSS loading logic to differentiate between production and theme environments.
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the CSS loading logic to handle production builds separately from theme development environments.
- Adds a branch to load raw
styles.csswith inline imports when not in production andhugo.Environmentis"theme". - Refactors how CSS is concatenated, minified, and fingerprinted in production and default (non-theme) environments.
…ronments - Refactored the CSS loading logic to ensure proper handling of stylesheets in both production and development modes. - Consolidated the CSS concatenation and minification process for production, while simplifying the development loading process.
- Updated the CSS loading logic in head.html to streamline the process for development environments by renaming the variable for clarity and ensuring proper handling of stylesheets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where the theme environment wasn't properly detected when loading CSS, ensuring that tailwind compilation is only triggered when needed.
- Introduces a dedicated branch for the "theme" development environment using postCSS on "css/styles.css".
- Updates the non-production non-theme branch to use the precompiled "css/compiled/main.css".
Comments suppressed due to low confidence (1)
layouts/partials/head.html:44
- Confirm that using the precompiled "css/compiled/main.css" in the non-production non-theme branch is intended, as the previous logic applied postCSS on "css/styles.css".
{{- $styles := resources.Get "css/compiled/main.css" -}}
| {{- $styles := slice $variablesCss $mainCss $customCss | resources.Concat "css/compiled/main.css" | minify | fingerprint }} | ||
| <link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" /> | ||
| <link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" /> | ||
| {{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }} |
Copilot
AI
May 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding an inline comment explaining the rationale for treating the "theme" environment separately to improve maintainability.
|
Please re-open #690. The documentation is still wrong. https://imfing.github.io/hextra/docs/getting-started/#setup-hextra-as-git-submodule It doesn't work. Once you think you have fixed the documentation, have someone test it starting out in an empty directory. |
This PR fixes an issue introduced in #678 that detecting the "theme" environment was removed. Thus when the theme was loaded from submodule, it attempts to compile the tailwind css
closes #690