devlooped / nugetizer

A simple to understand packing model for authoring NuGet packages
https://clarius.org/nugetizer/
MIT License
260 stars 7 forks source link

Razor class libraries and static web assets #506

Open NormanM123 opened 3 months ago

NormanM123 commented 3 months ago

Describe the Bug

When using nugetizer to pack Razor class libraries, static web assets that are generated during the build process (like scoped CSS or JavaScript files collocated with a component) are not included in the package. Files under "./wwwroot" are placed under ".contentFiles" in the package, which is the wrong location.

Steps to Reproduce

Create a Razor class library project and add the dependency to nugetizer. In the subfolder "./Components", add a Razor Component "Test.razor" and a scoped CSS file "Test.razor.css." with arbitrary content.

Create a file test.js in the "./wwwroot" folder.

Run dotnet pack on the project.

Expected Behavior

There should be a folder "./staticwebassets" within the package and another .props file in the build folder which copies the static assets during builds of projects that depend on the generated package.

The "./staticwebassets" folder should contain all generated static web assets and all static web assets which have been placed under the "./wwwroot" folder in the project.

Observed Behavior

The "./staticwebassets" folder is not created within the package. Scoped CSS and collocated JavaScript are not included in the package. Files under "./wwwroot" are included as contentFiles.

Removing the dependency to nugetizer and running dotnet pack gives the expected behavior.

Is there a workaround for this without having to remove the dependency to nugetizer?

Back this issue Back this issue

kzu commented 3 months ago

I did an initial investigation. This requires adding specific support for static web assets SDK in nugetizer.

Please consider sponsoring this development. Otherwise it's low priority for me personally.

Thanks in advance!