Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude css isolation assets from dotnet publish #41961

Open
1 task done
lonix1 opened this issue Jun 1, 2022 · 0 comments
Open
1 task done

Exclude css isolation assets from dotnet publish #41961

lonix1 opened this issue Jun 1, 2022 · 0 comments

Comments

@lonix1
Copy link

@lonix1 lonix1 commented Jun 1, 2022

Originally posted at StackOverflow, but there seems no way to control this. So I'm adding as a feature request. Thank you.

Is there an existing issue for this?

  • I have searched the existing issues

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

I'm using RazorPages (on ASP.NET Core 6) and "css isolation". The css files are generated at obj/{Debug,Release}/net6.0/scopedcss/Pages/, and are included when performing a dotnet publish.

I also use Webpack, so I don't need to publish those css files (they are already bundled by Webpack).

I added variations of all of these to my Project.csproj without success:

<ItemGroup Condition="'$(Configuration)'=='Release'">
  <Content Remove="obj/*/*/scopedcss/**/*" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
  <Content Remove="*.cshtml.rz.scp.css" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
  <None Remove="obj/*/*/scopedcss/**/*" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
  <Compile Remove="*.cshtml.rz.scp.css" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
  <PublishedFiles Remove="obj/*/*/scopedcss/**/*" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
  <DefaultItemExcludes>$(DefaultItemExcludes);obj/*/*/scopedcss/**/*</DefaultItemExcludes>
</PropertyGroup>

These (and variations of them in every combination) did not work.

Describe the solution you'd like

Please provide a way to exclude css isolation assets from dotnet publish.

Additional context

My non-ideal workaround is to delete the files after publish:

<Target Name="DeleteScopedCss" AfterTargets="AfterPublish">
  <RemoveDir Directories="$(PublishUrl)/wwwroot/Pages" />
</Target>
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

No branches or pull requests

1 participant