Git Product home page Git Product logo

aspnetstatic's People

Contributors

dpenton avatar zarehd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aspnetstatic's Issues

[Feature Request] Can we do something when processing resource?

Is your feature request related to a problem? Please describe.

I am trying to use this library to generate static pages for vintage devices.

Everything is fine but I met a problem.

I need to convert WebP images to JPG images for WebP images can't be displayed on some devices. But there's no way to do that when using BinResource.

Describe the solution you'd like

We can add a middleware, so that we can modify resource's content before AspNetStatic copys resource to the output directory.

For example:

var options = new StaticContentResourceOptions()
{
    OnProcessResource = (StaticContentResourceContext context) =>
    {
        if (context.Url.EndWith(".webp"))
        {
            Stream resContent = context.ResourceContent;
            // Do something here...
        }
    }
};
app.UseStaticContentResourceProcessing(options);

Describe alternatives you've considered

Instead of using BinResource, I manually modified file and copied it to the output directory. But this is inconvenient.

Additional context

No

Invalidation service

Hi,

is there an invalidation service? e.g. I have webhooks that can be used to refresh the content and I would like to integrate every page.

[Feature request] Support for custom root paths

Problem to solve

I am trying to use this library to generate static pages from a razor pages app to host on Github Pages. The problem is that the pages work locally, but not in GP, since it uses www.{username}.github.io/{projectName}/ URL structure. This causes root paths to point to www.{username}.github.io/

I tried using:

var builder = WebApplication.CreateBuilder(new WebApplicationOptions()
{
    WebRootPath = "wwwroot/AwesomeProject"
});

and

app.UsePathBase("/projectName");

But it does not seem to do anything. I know Hugo allows to define the project base URL path in config.toml. Maybe I am missing some builtin functionality, but I don't seem to find a way to solve this currently.

Proposal

Add support for replacing ~ with a custom BaseURL string for all paths beginning with ~/.

Common StaticResourcesInfoProviders

Is your feature request related to a problem? Please describe.
It would be nice if you provided some common implementations of IStaticResourcesInfoProvider

Describe the solution you'd like
Using blazor ssr to build websites is now a very nice experience. It would be great to support that quickly out of the box. For example,
a RazorComponentsStaticResourcesInfoProvider would automatically register all /page routes and anything in the wwwroot folder would make getting going with AspNetStatic in that use case really great.

Describe alternatives you've considered
That may be too restrictive so you could move towards a builder pattern that enables you to quickly configure common patterns in to an overall InfoProvider. For example:

var infoProvider = new StaticResourcesInfoProviderBuilder()
    .AddRazorComponentPages()
    .AddWwwRoot()
   .Build();
```

I've not got anything like this working myself yet but happy to contribute back if it seems useful?

Multiple question about Features

First of all, thank you for this library. It is a nice idea I was looking for for a long time.
I am trying AspNetStatic with .NET 8 with the Blazor approach. That way I can use Blazor components for building static website - what a dream. It all works, almost no extra setup is needed. Great.

I have few questions and ideas about what is possible:

Input pages without specifying them

currently we have this:

builder.Services.AddSingleton<IStaticPagesInfoProvider>(
new StaticPagesInfoProvider(
new PageInfo[]
{
    new("/") { OutFile = "index.html" },
    new("/app.css") { OutFile = "app.css"},

})
); 

Is it possible to have something like:

builder.Services.AddSingleton<IStaticPagesInfoProvider>(
new StaticPagesInfoProvider(
ConvertAllPagesBaseOnPageDirective = true)
); 

That would simplify things..

Copy files and folders

As you can see, I am using the PageInfo to copy app.css file. It works ok for text files, but not so much for images.
It would be cool to be able to:

new("wwwroot") { JustCopy = true, Recursive = true},

I know the path is the path for web app, not the file system, but you got the idea.

File generation middleware

It would be useful to be able to "do something" with file before it is saved.

I can help with those if necessary. But I am curious if not missing something.
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.