-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Fix generated CSS scopes in layout views and update templates #31257
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ body { | |
width: 100%; | ||
white-space: nowrap; | ||
line-height: 60px; /* Vertically center the text there */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...tTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification | ||
for details on configuring this project to bundle and minify static web assets. */ | ||
|
||
a.navbar-brand { | ||
white-space: normal; | ||
text-align: center; | ||
word-break: break-all; | ||
} | ||
|
||
/* Provide sufficient contrast against white background */ | ||
a { | ||
color: #0366d6; | ||
} | ||
|
||
.btn-primary { | ||
color: #fff; | ||
background-color: #1b6ec2; | ||
border-color: #1861ac; | ||
} | ||
|
||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { | ||
color: #fff; | ||
background-color: #1b6ec2; | ||
border-color: #1861ac; | ||
} | ||
|
||
/* Sticky footer styles | ||
-------------------------------------------------- */ | ||
html { | ||
font-size: 14px; | ||
} | ||
@media (min-width: 768px) { | ||
html { | ||
font-size: 16px; | ||
} | ||
} | ||
|
||
.border-top { | ||
border-top: 1px solid #e5e5e5; | ||
} | ||
.border-bottom { | ||
border-bottom: 1px solid #e5e5e5; | ||
} | ||
|
||
.box-shadow { | ||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); | ||
} | ||
|
||
button.accept-policy { | ||
font-size: 1rem; | ||
line-height: inherit; | ||
} | ||
|
||
/* Sticky footer styles | ||
-------------------------------------------------- */ | ||
html { | ||
position: relative; | ||
min-height: 100%; | ||
} | ||
|
||
body { | ||
/* Margin bottom by footer height */ | ||
margin-bottom: 60px; | ||
} | ||
.footer { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
white-space: nowrap; | ||
line-height: 60px; /* Vertically center the text there */ | ||
} | ||
|
71 changes: 0 additions & 71 deletions
71
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...s/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "aa3144e1672369f198372f95e6bbee5ac485c5c3" | ||
// <auto-generated/> | ||
#pragma warning disable 1591 | ||
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] | ||
namespace AspNetCore | ||
{ | ||
#line hidden | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"aa3144e1672369f198372f95e6bbee5ac485c5c3", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] | ||
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic> | ||
{ | ||
#pragma warning disable 1998 | ||
public async override global::System.Threading.Tasks.Task ExecuteAsync() | ||
{ | ||
WriteLiteral("\r\n<!DOCTYPE html>\r\n<html TestCssScope lang=\"en\">\r\n<head TestCssScope>\r\n <meta TestCssScope charset=\"utf-8\" />\r\n <meta TestCssScope name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n <title TestCssScope>"); | ||
#nullable restore | ||
#line 7 "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" | ||
Write(ViewData["Title"]); | ||
|
||
#line default | ||
#line hidden | ||
#nullable disable | ||
WriteLiteral(" - Test layout component</title>\r\n</head>\r\n<body TestCssScope>\r\n <p TestCssScope>This is a body.</p>\r\n</body>\r\n</html>\r\n"); | ||
} | ||
#pragma warning restore 1998 | ||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] | ||
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } | ||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] | ||
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } | ||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] | ||
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } | ||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] | ||
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } | ||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] | ||
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; } | ||
} | ||
} | ||
#pragma warning restore 1591 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. In the Blazor templates, we still have the global CSS files as well as the scoped ones. I see that you've been able to make the global one unnecessary here. Is it possible that developers will still want to have a global non-scoped CSS file too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
I've brought back the non-scoped CSS file and moved the
html
/body
style to it. This will help indicate to developers that non-scoped CSS files are still sensible to use in some scenarios.