Mulliman / xStatic-for-Umbraco

This is a static site generator built for Umbraco so that you can host simple Umbraco sites on fast and cheap hosting providers such as netlify.
42 stars 12 forks source link

Link href values to .CSS files not generating correctly #27

Open jacksorjacksor opened 1 year ago

jacksorjacksor commented 1 year ago

Hi there!

While I'm able to use xStatic to create a static version of my site with all the assets, the <head> elements of each page are missing the href values for the .CSS files. All the .CSS files have been copied across as expected.

The links to the .CSS files are created in Umbraco using SmidgeHelper.

Original

@{
    SmidgeHelper.RequiresCss("~/clean-assets/css/styles.css");
}

<head>
   @await SmidgeHelper.CssHereAsync(debug: false)
</head>

xStatic

    <!-- Core theme CSS (includes Bootstrap)-->
    <link href="/sc/0c03902b.css.v1" rel="stylesheet">

This may be a case of me not having implemented (any) transformers, or any other functionality of xStatic.

Unsure if this is an issue and more just me missing something, but let me know how I can set the links correctly.

Thank you so much for making this package, it's HUGELY valuable - hope to get to know it better to be able to support it in future!

Rich

System info:

Category Data
Server OS Microsoft Windows 10.0.22621
Server Framework .NET 6.0.24
Default Language en-US
Umbraco Version 10.7.0
Current Culture en-US
Current UI Culture en-US
Current Webserver IIS
Models Builder Mode SourceCodeManual
Debug Mode True
Database Provider Microsoft.Data.SqlClient
Current Server Role Single
Browser Edge-chromium 118.0.2088.61
Browser OS Win32
Mulliman commented 1 year ago

Hey

Are the files generated and exported by xStatic called /clean-assets/css/styles.css, 0c03902b.css.v1 or 0c03902b.css?

I think that there's a disconnect between how the css files are transferred to the output directory and how they are referenced in the html.

The css files are directly copied from the filesystem. The HTML pages are copied from the output from calling the Umbraco site over HTTP.

I personally haven't used Smidge but I think that's where the issue is here, I just directly reference the files in the views rather than via a tool that bundles everything together.

Without seeing how it all fits together I don't know what the best way is to do this, but this would likely need a custom generator to handle this.

jacksorjacksor commented 1 year ago

Morning

Are the files generated and exported by xStatic called /clean-assets/css/styles.css, 0c03902b.css.v1 or 0c03902b.css?

/clean-assets/css/styles.css

Will look into further and report back. Had more success with not using Smidge (but now at work).