Skip to content

Commit

Permalink
Support language-specific CSS files #3464 (#3978)
Browse files Browse the repository at this point in the history
Support language-specific CSS files 
Co-authored-by: Jonathan Giles <jonathan.giles@microsoft.com>
  • Loading branch information
cmcd22 authored Aug 30, 2022
1 parent ae53c40 commit d5dd8f4
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 3 deletions.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
17 changes: 15 additions & 2 deletions src/dotnet/APIView/APIViewWeb/Client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,20 @@ module.exports = {
navbar: './src/navbar.ts',
review: './src/review.ts',
reviews: './src/reviews.ts',
site: './css/site.scss'
site: './css/site.scss',

c: './css/c.scss',
cplusplus: './css/cplusplus.scss',
csharp: './css/csharp.scss',
go: './css/go.scss',
java: './css/java.scss',
javascript: './css/javascript.scss',
json: './css/json.scss',
kotlin: './css/kotlin.scss',
python: './css/python.scss',
swagger: './css/swagger.scss',
swift: './css/swift.scss',
xml: './css/xml.scss'
},
devtool: 'source-map',
module: {
Expand Down Expand Up @@ -45,7 +58,7 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin({
filename: 'site.css'
filename: "[name].css"
}),
],
resolve: {
Expand Down
15 changes: 15 additions & 0 deletions src/dotnet/APIView/APIViewWeb/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
<!-- BootStrap Select -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css"/>
<link id="theme-css" rel="stylesheet" href="~/site.css" asp-append-version="true" />
@{
var modelType = ViewData.ModelMetadata.ModelType.Name;
if (modelType == "ReviewPageModel")
{
@functions {
public string getLanguage()
{
return ViewData.Model.Review.GetLanguageCssSafeName();
}
}
var lang = getLanguage();
var hrefNew = "~/" + lang + ".css";
<link rel="stylesheet" href=@hrefNew asp-append-version="true"/>
}
}
</head>
@{
var userPreference = (ViewData["UserPreference"] as UserPreferenceModel) ?? new UserPreferenceModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"applicationUrl": "http://localhost:5000"
}
}
}
}

0 comments on commit d5dd8f4

Please sign in to comment.