File size: 21,740 Bytes
090629c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<!--

***********************************************************************************************

Microsoft.NET.Sdk.StaticWebAssets.ScopedCss.targets



WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have

          created a backup copy.  Incorrect changes to this file will make it

          impossible to load or build your projects from the command-line or the IDE.



Copyright (c) .NET Foundation. All rights reserved.

***********************************************************************************************

-->

<Project ToolsVersion="14.0">

<!-- General description of the scoped CSS pipeline and its integration with static web assets:

* Scoped css files get discovered and put into a ScopedCssInput itemgroup.

* Any file with a *.razor.css extension gets processed as a scoped css file. That means two things:

  * A uniquely identifying scope attribute is generated for that file.

  * The file will be transformed to apply the unique scope to all selectors and a new file will be generated.

  * This new file along with the scope will be added to the ScopedCss itemgroup.

  * When resolving Razor inputs we will match RazorComponent items with their associated ScopedCss item by convention.

    * The convention is that the scoped css file will have to have the same full path as the razor file with the addition of the .css extension.

    * Users can define their own convention by adding their own ScopedCssInput item with the RazorComponent metadata on it.

      * This metadata will point to the item spec for a given RazorComponent (typically the path from the root of the project)

  * At this point, if a razor.css file doesn't have an associated RazorComponent it will be discarded and not included in the final bundle.

    * This makes sure that the scoped css pipeline and the components pipeline are as orthogonal as possible.

    * Computing the scopes will happen very early on the pipeline and it will generate all the input that the compiler needs to do its job

      independently.

* For web applications (Blazor webassembly and Blazor server) the main project is responsible for producing the final CSS bundle and making

  it available during development and production behind $(PackageId).styles.css

* For razor class libraries we will add the list of ScopedCss to the list of available static web assets imported by the project, the main project

  will then discover these assets and add them to the ScopedCss files to process in the final bundle.

* For packing in razor class libraries, the ScopedCss files will get processed and added as static web assets to the pack.



Integration with static web assets:

* The generated scoped css files will be added as regular static web assets to participate in the pipeline.

  * Generated scoped css files will have a unique extension '.rz.scp.css' that will be used by the pipeline to identify them as such.

* In razor class libraries these generated files will be packaged normally as part of the static web assets process and if bundling is

  not enabled would be normally accessible at <<StaticWebAssetsBasePath>>/<<RelativePath>>.

* When bundling is enabled (there's no actual way to disable it) all scoped css files from class libraries will be identified by looking

  at the list of static web assets and identifying the ones that have a .rz.scp.css extension.

  * Using the extension is useful as it allows for third party tooling to do alternative processing in an easy way, these files will be

    removed off from the list of static web assets when the default bundling is enabled, so they won't show up in the final output.

-->

<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.DiscoverDefaultScopedCssItems"  AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ResolveAllScopedCssAssets"  AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCssScopes" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ComputeCssScope" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.RewriteCss" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ConcatenateCssFiles" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />

<PropertyGroup Condition="'$(DisableScopedCssBundling)' != 'true'">

  <ResolveStaticWebAssetsInputsDependsOn>
    $(ResolveStaticWebAssetsInputsDependsOn);
    UpdateLegacyPackageScopedCssBundles;
    _AddScopedCssBundles;
  </ResolveStaticWebAssetsInputsDependsOn>

  <GenerateComputedBuildStaticWebAssetsDependsOn>
    $(GenerateComputedBuildStaticWebAssetsDependsOn);
    _ResolveBundlingConfiguration;
    _GenerateScopedCssFiles;
    BundleScopedCssFiles;
  </GenerateComputedBuildStaticWebAssetsDependsOn>

  <ResolveScopedCssOutputsDependsOn>
    $(ResolveScopedCssOutputsDependsOn);
  </ResolveScopedCssOutputsDependsOn>

</PropertyGroup>

<PropertyGroup Condition="'$(DisableScopedCssBundling)' == 'true'">

  <ResolveStaticWebAssetsInputsDependsOn>
    $(ResolveStaticWebAssetsInputsDependsOn);
    UpdateLegacyPackageScopedCssBundles;
    _AddGeneratedScopedCssFiles;
  </ResolveStaticWebAssetsInputsDependsOn>

  <GenerateComputedBuildStaticWebAssetsDependsOn>
    _GenerateScopedCssFiles;
    $(GenerateComputedBuildStaticWebAssetsDependsOn);
  </GenerateComputedBuildStaticWebAssetsDependsOn>

  <ResolveScopedCssOutputsDependsOn>
    $(ResolveScopedCssOutputsDependsOn);
  </ResolveScopedCssOutputsDependsOn>

</PropertyGroup>

<PropertyGroup>
  <!-- We are going to use .rz.scp.css as the extension to mark scoped css files that come from packages or that have been pre-procesed by

       referenced class libraries. This way, we can use that information to adjust the build pipeline without having to rely on external

       sources like an additional itemgroup or metadata.

  -->
  <_ScopedCssExtension>.rz.scp.css</_ScopedCssExtension>
</PropertyGroup>

<Target Name="ResolveScopedCssInputs">
  <!--

  Gathers input source files for Razor component generation. This is a separate target so that we can avoid

  lots of work when there are no inputs for code generation.



  NOTE: This target is called as part of an incremental build scenario in VS. Do not perform any work

  outside of calculating RazorComponent items in this target.

  -->
  <DiscoverDefaultScopedCssItems Condition="'$(EnableDefaultScopedCssItems)' == 'true'" Content="@(None);@(Content)" SupportsScopedCshtmlCss="true">
    <Output TaskParameter="DiscoveredScopedCssInputs" ItemName="_DiscoveredScopedCssInputs" />
  </DiscoverDefaultScopedCssItems>

  <ItemGroup Condition="'$(EnableDefaultScopedCssItems)' == 'true'">
    <ScopedCssInput Include="@(_DiscoveredScopedCssInputs)" />
  </ItemGroup>

  <ItemGroup>
    <Content Remove="@(ScopedCssInput)" />
    <Content Include="@(ScopedCssInput)" Pack="false" CopyToPublishDirectory="Never" />
  </ItemGroup>
</Target>

<!-- This target just generates a Scope identifier for the items that we deemed were scoped css files -->
<Target Name="ComputeCssScope" DependsOnTargets="ResolveScopedCssInputs">
  <ComputeCssScope ScopedCssInput="@(ScopedCssInput)" Targetname="$(TargetName)">
    <Output TaskParameter="ScopedCss" ItemName="_ScopedCss" />
  </ComputeCssScope>
</Target>

<!-- Sets the output path for the processed scoped css files. They will all have a '.rz.scp.css' extension to flag them as processed

     scoped css files. -->
<Target Name="ResolveScopedCssOutputs" DependsOnTargets="$(ResolveScopedCssOutputsDependsOn)">
  <PropertyGroup>
    <_ScopedCssIntermediatePath>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)scopedcss\))</_ScopedCssIntermediatePath>
  </PropertyGroup>

  <ItemGroup>
    <_ScopedCss Condition="'%(_ScopedCss.Identity)' != ''">
      <OutputFile>$(_ScopedCssIntermediatePath)%(RelativeDir)%(RecursiveDir)%(FileName)$(_ScopedCssExtension)</OutputFile>
      <RelativePath>%(RelativeDir)%(RecursiveDir)%(FileName)$(_ScopedCssExtension)</RelativePath>
    </_ScopedCss>
    <_ScopedCssOutputs Include="%(_ScopedCss.OutputFile)" />
  </ItemGroup>

  <!-- https://github.com/dotnet/project-system/blob/main/docs/up-to-date-check.md -->
  <ItemGroup>
    <UpToDateCheckInput Include="%(_ScopedCss.Identity)" />
    <UpToDateCheckBuilt Include="%(_ScopedCss.OutputFile)" Original="%(_ScopedCss.Identity)" />
  </ItemGroup>

</Target>

<Target

    Name="_ResolveScopedCssOutputsDesignTime"

    DependsOnTargets="ResolveScopedCssOutputs"

    BeforeTargets="CollectUpToDateCheckInputDesignTime;CollectUpToDateCheckBuiltDesignTime" />

<!-- Transforms the original scoped CSS files into their scoped versions on their designated output paths -->
<Target Name="_GenerateScopedCssFiles" Inputs="@(_ScopedCss)" Outputs="@(_ScopedCssOutputs)" DependsOnTargets="ResolveScopedCssOutputs">

  <MakeDir Directories="$(_ScopedCssIntermediatePath)" />
  <RewriteCss FilesToTransform="@(_ScopedCss)" />

  <ItemGroup>
    <FileWrites Include="%(_ScopedCss.OutputFile)" />
  </ItemGroup>
</Target>

<!--

  This target is added to ResolveStaticWebAssetInputs which only gets called by the main application.

  This makes sure we only include the bundle file when we are processing an application for build/publish

  and avoids including it on razor class libraries.

  In the hosted blazor webassembly case, we want to include the bundle within the assets returned to the host, so we wire up this task

  to `GetCurrentProjectStaticWebAssetsDependsOn` so that contents are replaced and shared with the host application.



  Normally, _CollectAllScopedCssAssets will find all the scoped css files from referenced packages, class libraries and the current project. When _AddScopedCssBundles

  runs, it will remove all those static web assets and add the bundle asset.

  When _CollectAllScopedCssAssets runs as part of a hosted blazor webassembly app, only the current project and package assets are removed from the list of

  static web assets. If the host also decides to generate a bundle, there will be a bundle for the razor client app and another bundle for the host and they will

  contain some overlapping css.

  * The bundle for the client app will contain the transitive closure of the processed css files for the client app.

  * The bundle for the server app will contain the css for the referenced class libraries (transitively and the packages).

    * Users in this position can choose to remove CssScopedInput entries to avoid including them in the host bundle.



  For Blazor webassembly we want to trigger the bundling at the Blazor client level so that different applications can have self-contained bundles. For the most

  common case, the bundle for a Blazor app and its host should be identical modulo path comments on the bundle.



  If one single bundle is desired, bundling can be disabled in the Blazor application and the host will create a single big bundle file.



-->

<Target Name="_ResolveBundlingConfiguration" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
  <PropertyGroup>
    <_ScopedCssIntermediatePath>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)scopedcss\))</_ScopedCssIntermediatePath>
    <!-- This bundle represents the bundle for the entire application dependency graph which includes the application scoped css files and all the scoped css files from

         projects and packages that this app references -->
    <_ScopedCssBundleContentRoot>$(_ScopedCssIntermediatePath)bundle\</_ScopedCssBundleContentRoot>
    <_ScopedCssOutputPath>$(_ScopedCssIntermediatePath)bundle\$(PackageId).styles.css</_ScopedCssOutputPath>
    <_ScopedCssOutputFullPath>$([System.IO.Path]::Combine('$(MSBuildProjectFileDirectory)', '$(_ScopedCssIntermediatePath)bundle\$(PackageId).styles.css'))</_ScopedCssOutputFullPath>

    <!-- This bundle represents the bundle for the scoped css files in this project, without references to other projects or package scoped css files. This bundle is used by projects

         referencing this project that import it through an import rule into their app bundle -->
    <_ScopedCssProjectBundleContentRoot>$(_ScopedCssIntermediatePath)projectbundle\</_ScopedCssProjectBundleContentRoot>
    <_ScopedCssProjectOutputPath>$(_ScopedCssIntermediatePath)projectbundle\$(PackageId).bundle.scp.css</_ScopedCssProjectOutputPath>
    <_ScopedCssProjectOutputFullPath>$([System.IO.Path]::Combine('$(MSBuildProjectFileDirectory)', '$(_ScopedCssIntermediatePath)projectbundle\$(PackageId).bundle.scp.css'))</_ScopedCssProjectOutputFullPath>
    <!-- We want the scoped css bundle path to always point to the root path of the app, overriding the default base path unless it is not explicitly overriden

    by the user. This is so that when you are developing a server-side application or in the future potentially an ASP.NET application using css isolation,

    you don't have to make the urls in your files relative to "_content/$(PackageId).styles.css".

    If the user chooses to override the base path explicitly, we place the bundle at the root of the defined base path, this allows Blazor WebAssembly applications to be hosted

    on different paths other than the root path and for the bundle to behave as expected

    -->
    <_ScopedCssBundleBasePath>/</_ScopedCssBundleBasePath>
    <_ScopedCssBundleBasePath Condition="'$(StaticWebAssetBasePath)' != '_content/$(PackageId)'">$(StaticWebAssetBasePath)</_ScopedCssBundleBasePath>
  </PropertyGroup>
</Target>

<Target Name="_AddScopedCssBundles" Condition="'$(DisableScopedCssBundling)' != 'true'" DependsOnTargets="_ResolveBundlingConfiguration;_CollectAllScopedCssAssets">

  <ItemGroup>
    <_ScopedCssAppBundleStaticWebAsset Include="$(_ScopedCssOutputPath)">
      <RelativePath>$(PackageId).styles.css</RelativePath>
    </_ScopedCssAppBundleStaticWebAsset>
    <_ScopedCssProjectBundleStaticWebAsset Include="$(_ScopedCssProjectOutputPath)">
      <RelativePath>$(PackageId).bundle.scp.css</RelativePath>
    </_ScopedCssProjectBundleStaticWebAsset>
  </ItemGroup>

  <DefineStaticWebAssets Condition="@(_AllScopedCss) != ''"

    CandidateAssets="@(_ScopedCssAppBundleStaticWebAsset)"

    SourceType="Computed"

    SourceId="$(PackageId)"

    ContentRoot="$(_ScopedCssBundleContentRoot)"

    BasePath="$(StaticWebAssetBasePath)"

    AssetKind="All"

    AssetMode="CurrentProject"

    AssetRole="Primary"

    AssetMergeSource="$(StaticWebAssetMergeTarget)"

    RelatedAsset=""

    AssetTraitName="ScopedCss"

    AssetTraitValue="ApplicationBundle"

    CopyToOutputDirectory="Never"

    CopyToPublishDirectory="PreserveNewest"

  >
    <Output TaskParameter="Assets" ItemName="StaticWebAsset" />
  </DefineStaticWebAssets>

  <DefineStaticWebAssets Condition="@(_ScopedCss) != ''"

    CandidateAssets="@(_ScopedCssProjectBundleStaticWebAsset)"

    SourceType="Computed"

    SourceId="$(PackageId)"

    ContentRoot="$(_ScopedCssProjectBundleContentRoot)"

    BasePath="$(StaticWebAssetBasePath)"

    AssetKind="All"

    AssetMode="Reference"

    AssetRole="Primary"

    RelatedAsset=""

    AssetMergeSource="$(StaticWebAssetMergeTarget)"

    AssetTraitName="ScopedCss"

    AssetTraitValue="ProjectBundle"

    CopyToOutputDirectory="Never"

    CopyToPublishDirectory="PreserveNewest"

  >
    <Output TaskParameter="Assets" ItemName="StaticWebAsset" />
  </DefineStaticWebAssets>

</Target>

<!-- This target runs as part of ResolveStaticWebAssetInputs and collects all the generated scoped css files. When bundling is enabled

     these files are removed from the list of static web assets by '_AddScopedCssBundles' -->

<Target Name="_CollectAllScopedCssAssets" DependsOnTargets="_ComputeScopedCssStaticWebAssets">
  <ResolveAllScopedCssAssets StaticWebAssets="@(StaticWebAsset);@(_ScopedCssStaticWebAsset)">
    <Output TaskParameter="ScopedCssAssets" ItemName="_DiscoveredScopedCssFiles" />
    <Output TaskParameter="ScopedCssProjectBundles" ItemName="_ScopedCssProjectBundles" />
  </ResolveAllScopedCssAssets>

  <ItemGroup>
    <_AllScopedCss Include="@(_ScopedCssProjectBundles);@(_DiscoveredScopedCssFiles)" />
  </ItemGroup>

  <!-- https://github.com/dotnet/project-system/blob/main/docs/up-to-date-check.md -->
  <ItemGroup>
    <UpToDateCheckInput Include="@(_AllScopedCss)" />
    <UpToDateCheckBuilt Include="$(_ScopedCssOutputFullPath)" />
    <UpToDateCheckBuilt Include="$(_ScopedCssProjectOutputFullPath)" />
  </ItemGroup>

</Target>

<Target Name="_ComputeScopedCssStaticWebAssets" DependsOnTargets="ResolveScopedCssOutputs;ResolveStaticWebAssetsConfiguration">
  <ItemGroup>
    <_ScopedCssCandidateFile Include="%(_ScopedCss.OutputFile)" Condition="@(_ScopedCss) != ''">
      <RelativePath>%(_ScopedCss.RelativePath)</RelativePath>
      <OriginalItemSpec>%(_ScopedCss.Identity)</OriginalItemSpec>
    </_ScopedCssCandidateFile>
  </ItemGroup>

  <DefineStaticWebAssets Condition="@(_ScopedCss) != ''"

    CandidateAssets="@(_ScopedCssCandidateFile)"

    SourceType="Computed"

    SourceId="$(PackageId)"

    ContentRoot="$(IntermediateOutputPath)scopedcss\"

    BasePath="$(StaticWebAssetBasePath)"

    AssetKind="All"

    AssetMode="All"

    AssetRole="Primary"

    AssetMergeSource="$(StaticWebAssetMergeTarget)"

    AssetTraitName="ScopedCss"

    AssetTraitValue="ScopedCssFile"

    CopyToOutputDirectory="Never"

    CopyToPublishDirectory="PreserveNewest"

  >
    <Output TaskParameter="Assets" ItemName="_ScopedCssStaticWebAsset" />
  </DefineStaticWebAssets>
</Target>

<Target Name="_AddGeneratedScopedCssFiles" DependsOnTargets="_ComputeScopedCssStaticWebAssets">
  <ItemGroup>
    <StaticWebAsset Include="@(_ScopedCssStaticWebAsset)" />
  </ItemGroup>
</Target>

<Target Name="BundleScopedCssFiles" Condition="'$(DisableScopedCssBundling)' != 'true'" DependsOnTargets="_CollectAllScopedCssAssets;_GenerateScopedCssFiles;_ResolveBundlingConfiguration" >
  <!-- Incrementalism is built into the task itself. -->
  <ItemGroup>
    <_CurrentProjectDiscoveredScopedCssFiles Include="@(_DiscoveredScopedCssFiles)" />
  </ItemGroup>

  <!-- This is the bundle for the app, we will always generate it when there are scoped css files for the current project or

       we detected existing bundles available. If some other project/package didn't bundle their assets, we will not be including

       them in this bundle. -->

  <ConcatenateCssFiles

    Condition="'@(_ScopedCssProjectBundles)' != '' or '@(_ScopedCss)' != ''"

    ScopedCssFiles="@(_CurrentProjectDiscoveredScopedCssFiles)"

    ProjectBundles="@(_ScopedCssProjectBundles)"

    ScopedCssBundleBasePath="$(_ScopedCssBundleBasePath)"

    OutputFile="$(_ScopedCssOutputPath)" />

  <!-- This is the project bundle, we will only generate it when there are scoped files defined in the project. This bundle will be used

       when the project is referenced from another project or packed as a package (Razor Class Library). If some other project/package

       didn't bundle their assets, we will not be including them in this bundle. -->
  <ConcatenateCssFiles

    Condition="'@(_ScopedCss)' != ''"

    ScopedCssFiles="@(_CurrentProjectDiscoveredScopedCssFiles)"

    ProjectBundles=""

    ScopedCssBundleBasePath="$(_ScopedCssBundleBasePath)"

    OutputFile="$(_ScopedCssProjectOutputPath)" />

  <ItemGroup>
    <FileWrites Include="$(_ScopedCssOutputPath)" />
    <FileWrites Condition="'@(_ScopedCss)' != ''" Include="$(_ScopedCssProjectOutputPath)" />
  </ItemGroup>

</Target>

<!-- Back-compat -->

  <Target Name="UpdateLegacyPackageScopedCssBundles" DependsOnTargets="UpdateExistingPackageStaticWebAssets">
    <ItemGroup>
      <_LegacyOverrides Include="AssetMode" />
      <_PackageProjectBundleCandidates Include="@(StaticWebAsset)" Condition="'%(SourceType)' == 'Package'" />
    </ItemGroup>
    <DefineStaticWebAssets

      CandidateAssets="@(_PackageProjectBundleCandidates)"

      RelativePathFilter="**/*.bundle.scp.css"

      PropertyOverrides="@(_LegacyOverrides)"

      AssetMode="Reference"

      AssetRole="Primary"

      RelatedAsset=""

      AssetMergeSource="$(StaticWebAssetMergeTarget)"

      AssetTraitName="ScopedCss"

      AssetTraitValue="ProjectBundle"

    >
      <Output TaskParameter="Assets" ItemName="_UpdatedLegacyProjectBundles" />
    </DefineStaticWebAssets>

    <DefineStaticWebAssets

      CandidateAssets="@(_PackageProjectBundleCandidates)"

      RelativePathFilter="**/*.styles.css"

      PropertyOverrides="@(_LegacyOverrides)"

      AssetMode="CurrentProject"

      AssetRole="Primary"

      RelatedAsset=""

      AssetMergeSource="$(StaticWebAssetMergeTarget)"

      AssetTraitName="ScopedCss"

      AssetTraitValue="ApplicationBundle"

    >
    <Output TaskParameter="Assets" ItemName="_UpdatedLegacyAppBundles" />
  </DefineStaticWebAssets>


    <ItemGroup>
      <StaticWebAsset Remove="@(_UpdatedLegacyProjectBundles->'%(OriginalItemSpec)')" />
      <StaticWebAsset Include="@(_UpdatedLegacyProjectBundles)" />

      <StaticWebAsset Remove="@(_UpdatedLegacyAppBundles->'%(OriginalItemSpec)')" />
      <StaticWebAsset Include="@(_UpdatedLegacyAppBundles)" />
    </ItemGroup>

  </Target>

</Project>