nugetizer icon indicating copy to clipboard operation
nugetizer copied to clipboard

Razor class libraries and static web assets

Open NormanM123 opened this issue 1 year ago • 1 comments

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

NormanM123 avatar Aug 03 '24 19:08 NormanM123

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!

kzu avatar Aug 07 '24 18:08 kzu

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

github-actions[bot] avatar Mar 02 '25 01:03 github-actions[bot]

This issue will now be closed since it has been labeled 'stale' without activity for 30 days.

github-actions[bot] avatar Apr 01 '25 01:04 github-actions[bot]