Skip to content

Commit c51712c

Browse files
authored
Update templates to use scoped CSS
1 parent ddf61ba commit c51712c

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

src/ProjectTemplates/Shared/AspNetProcess.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ public async Task ContainsLinks(Page page)
139139
foreach (IHtmlLinkElement styleSheet in html.GetElementsByTagName("link"))
140140
{
141141
Assert.Equal("stylesheet", styleSheet.Relation);
142-
await AssertOk(styleSheet.Href.Replace("about://", string.Empty));
142+
// Workaround for https://github.com/dotnet/aspnetcore/issues/31030#issuecomment-811334450
143+
// Cleans up incorrectly generated filename for scoped CSS files
144+
var styleSheetHref = styleSheet.Href.Replace("_", string.Empty).Replace("about://", string.Empty);
145+
await AssertOk(styleSheetHref);
143146
}
144147
foreach (var script in html.Scripts)
145148
{

src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>@ViewData["Title"] - Company.WebApplication1</title>
77
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8-
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
8+
<link rel="stylesheet" href="~/Company.WebApplication1.styles.css" asp-append-version="true" />
99
</head>
1010
<body>
1111
<header>

src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>@ViewData["Title"] - Company.WebApplication1</title>
77
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8-
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
8+
<link rel="stylesheet" href="~/Company.WebApplication1.styles.css" asp-append-version="true" />
99
</head>
1010
<body>
1111
<header>

src/ProjectTemplates/test/template-baselines.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"Pages/_ViewImports.cshtml",
2323
"Pages/_ViewStart.cshtml",
2424
"Pages/Shared/_Layout.cshtml",
25+
"Pages/Shared/_Layout.cshtml.css",
2526
"Pages/Shared/_LoginPartial.cshtml",
2627
"Pages/Shared/_ValidationScriptsPartial.cshtml",
2728
"Properties/launchSettings.json",
2829
"wwwroot/favicon.ico",
29-
"wwwroot/css/site.css",
3030
"wwwroot/js/site.js",
3131
"wwwroot/lib/bootstrap/LICENSE",
3232
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -104,10 +104,10 @@
104104
"Pages/_ViewImports.cshtml",
105105
"Pages/_ViewStart.cshtml",
106106
"Pages/Shared/_Layout.cshtml",
107+
"Pages/Shared/_Layout.cshtml.css",
107108
"Pages/Shared/_ValidationScriptsPartial.cshtml",
108109
"Properties/launchSettings.json",
109110
"wwwroot/favicon.ico",
110-
"wwwroot/css/site.css",
111111
"wwwroot/js/site.js",
112112
"wwwroot/lib/bootstrap/LICENSE",
113113
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -185,11 +185,11 @@
185185
"Pages/_ViewImports.cshtml",
186186
"Pages/_ViewStart.cshtml",
187187
"Pages/Shared/_Layout.cshtml",
188+
"Pages/Shared/_Layout.cshtml.css",
188189
"Pages/Shared/_LoginPartial.cshtml",
189190
"Pages/Shared/_ValidationScriptsPartial.cshtml",
190191
"Properties/launchSettings.json",
191192
"wwwroot/favicon.ico",
192-
"wwwroot/css/site.css",
193193
"wwwroot/js/site.js",
194194
"wwwroot/lib/bootstrap/LICENSE",
195195
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -267,11 +267,11 @@
267267
"Pages/_ViewImports.cshtml",
268268
"Pages/_ViewStart.cshtml",
269269
"Pages/Shared/_Layout.cshtml",
270+
"Pages/Shared/_Layout.cshtml.css",
270271
"Pages/Shared/_LoginPartial.cshtml",
271272
"Pages/Shared/_ValidationScriptsPartial.cshtml",
272273
"Properties/launchSettings.json",
273274
"wwwroot/favicon.ico",
274-
"wwwroot/css/site.css",
275275
"wwwroot/js/site.js",
276276
"wwwroot/lib/bootstrap/LICENSE",
277277
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -349,10 +349,10 @@
349349
"Pages/_ViewImports.cshtml",
350350
"Pages/_ViewStart.cshtml",
351351
"Pages/Shared/_Layout.cshtml",
352+
"Pages/Shared/_Layout.cshtml.css",
352353
"Pages/Shared/_ValidationScriptsPartial.cshtml",
353354
"Properties/launchSettings.json",
354355
"wwwroot/favicon.ico",
355-
"wwwroot/css/site.css",
356356
"wwwroot/js/site.js",
357357
"wwwroot/lib/bootstrap/LICENSE",
358358
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -430,11 +430,11 @@
430430
"Pages/_ViewImports.cshtml",
431431
"Pages/_ViewStart.cshtml",
432432
"Pages/Shared/_Layout.cshtml",
433+
"Pages/Shared/_Layout.cshtml.css",
433434
"Pages/Shared/_LoginPartial.cshtml",
434435
"Pages/Shared/_ValidationScriptsPartial.cshtml",
435436
"Properties/launchSettings.json",
436437
"wwwroot/favicon.ico",
437-
"wwwroot/css/site.css",
438438
"wwwroot/js/site.js",
439439
"wwwroot/lib/bootstrap/LICENSE",
440440
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -611,10 +611,10 @@
611611
"Views/Home/Privacy.cshtml",
612612
"Views/Shared/Error.cshtml",
613613
"Views/Shared/_Layout.cshtml",
614+
"Views/Shared/_Layout.cshtml.css",
614615
"Views/Shared/_LoginPartial.cshtml",
615616
"Views/Shared/_ValidationScriptsPartial.cshtml",
616617
"wwwroot/favicon.ico",
617-
"wwwroot/css/site.css",
618618
"wwwroot/js/site.js",
619619
"wwwroot/lib/bootstrap/LICENSE",
620620
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -692,9 +692,9 @@
692692
"Views/Home/Privacy.cshtml",
693693
"Views/Shared/Error.cshtml",
694694
"Views/Shared/_Layout.cshtml",
695+
"Views/Shared/_Layout.cshtml.css",
695696
"Views/Shared/_ValidationScriptsPartial.cshtml",
696697
"wwwroot/favicon.ico",
697-
"wwwroot/css/site.css",
698698
"wwwroot/js/site.js",
699699
"wwwroot/lib/bootstrap/LICENSE",
700700
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -772,10 +772,10 @@
772772
"Views/Home/Privacy.cshtml",
773773
"Views/Shared/Error.cshtml",
774774
"Views/Shared/_Layout.cshtml",
775+
"Views/Shared/_Layout.cshtml.css",
775776
"Views/Shared/_LoginPartial.cshtml",
776777
"Views/Shared/_ValidationScriptsPartial.cshtml",
777778
"wwwroot/favicon.ico",
778-
"wwwroot/css/site.css",
779779
"wwwroot/js/site.js",
780780
"wwwroot/lib/bootstrap/LICENSE",
781781
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -853,10 +853,10 @@
853853
"Views/Home/Privacy.cshtml",
854854
"Views/Shared/Error.cshtml",
855855
"Views/Shared/_Layout.cshtml",
856+
"Views/Shared/_Layout.cshtml.css",
856857
"Views/Shared/_LoginPartial.cshtml",
857858
"Views/Shared/_ValidationScriptsPartial.cshtml",
858859
"wwwroot/favicon.ico",
859-
"wwwroot/css/site.css",
860860
"wwwroot/js/site.js",
861861
"wwwroot/lib/bootstrap/LICENSE",
862862
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -934,9 +934,9 @@
934934
"Views/Home/Privacy.cshtml",
935935
"Views/Shared/Error.cshtml",
936936
"Views/Shared/_Layout.cshtml",
937+
"Views/Shared/_Layout.cshtml.css",
937938
"Views/Shared/_ValidationScriptsPartial.cshtml",
938939
"wwwroot/favicon.ico",
939-
"wwwroot/css/site.css",
940940
"wwwroot/js/site.js",
941941
"wwwroot/lib/bootstrap/LICENSE",
942942
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
@@ -1014,10 +1014,10 @@
10141014
"Views/Home/Privacy.cshtml",
10151015
"Views/Shared/Error.cshtml",
10161016
"Views/Shared/_Layout.cshtml",
1017+
"Views/Shared/_Layout.cshtml.css",
10171018
"Views/Shared/_LoginPartial.cshtml",
10181019
"Views/Shared/_ValidationScriptsPartial.cshtml",
10191020
"wwwroot/favicon.ico",
1020-
"wwwroot/css/site.css",
10211021
"wwwroot/js/site.js",
10221022
"wwwroot/lib/bootstrap/LICENSE",
10231023
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",

0 commit comments

Comments
 (0)