Skip to content

Conversation

@imfing
Copy link
Owner

@imfing imfing commented May 30, 2025

  • Updated the CSS loading logic to differentiate between production and theme environments.

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

- Updated the CSS loading logic to differentiate between production and theme environments.
@imfing imfing linked an issue May 30, 2025 that may be closed by this pull request
@netlify
Copy link

netlify bot commented May 30, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 3d258d4
🔍 Latest deploy log https://app.netlify.com/projects/hugo-hextra/deploys/683a4544688ff20008b96c80
😎 Deploy Preview https://deploy-preview-691--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@imfing imfing requested a review from Copilot May 30, 2025 23:43
Copy link
Contributor

Copilot AI left a 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.css with inline imports when not in production and hugo.Environment is "theme".
  • Refactors how CSS is concatenated, minified, and fingerprinted in production and default (non-theme) environments.

imfing added 2 commits May 31, 2025 00:52
…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.
@imfing imfing requested a review from Copilot May 30, 2025 23:54
Copy link
Contributor

Copilot AI left a 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") }}
Copy link

Copilot AI May 30, 2025

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.

Copilot uses AI. Check for mistakes.
@imfing imfing merged commit 41140af into main May 30, 2025
4 checks passed
@imfing imfing deleted the 689-git-submodule branch May 30, 2025 23:56
@jmooring
Copy link

jmooring commented May 31, 2025

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.
It is a dead end for new users.

Once you think you have fixed the documentation, have someone test it starting out in an empty directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Remove or fix the "Setup Hextra as Git submodule" section Load tailwindcss ERROR when Set Hextra to Git submodule

3 participants