From d5dd8f4c9c59762b3abae66c5232e25337cfeafd Mon Sep 17 00:00:00 2001 From: cmcd22 <87786853+cmcd22@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:18:56 +1200 Subject: [PATCH] Support language-specific CSS files #3464 (#3978) Support language-specific CSS files Co-authored-by: Jonathan Giles --- src/dotnet/APIView/APIViewWeb/Client/css/c.scss | 0 .../APIViewWeb/Client/css/cplusplus.scss | 0 .../APIView/APIViewWeb/Client/css/csharp.scss | 0 .../APIView/APIViewWeb/Client/css/go.scss | 0 .../APIView/APIViewWeb/Client/css/java.scss | 0 .../APIViewWeb/Client/css/javascript.scss | 0 .../APIView/APIViewWeb/Client/css/json.scss | 0 .../APIView/APIViewWeb/Client/css/kotlin.scss | 0 .../APIView/APIViewWeb/Client/css/python.scss | 0 .../APIView/APIViewWeb/Client/css/swagger.scss | 0 .../APIView/APIViewWeb/Client/css/swift.scss | 0 .../APIView/APIViewWeb/Client/css/xml.scss | 0 .../APIView/APIViewWeb/Client/webpack.config.js | 17 +++++++++++++++-- .../APIViewWeb/Pages/Shared/_Layout.cshtml | 15 +++++++++++++++ .../APIViewWeb/Properties/launchSettings.json | 2 +- 15 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/c.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/cplusplus.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/csharp.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/go.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/java.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/javascript.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/json.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/kotlin.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/python.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/swagger.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/swift.scss create mode 100644 src/dotnet/APIView/APIViewWeb/Client/css/xml.scss diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/c.scss b/src/dotnet/APIView/APIViewWeb/Client/css/c.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/cplusplus.scss b/src/dotnet/APIView/APIViewWeb/Client/css/cplusplus.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/csharp.scss b/src/dotnet/APIView/APIViewWeb/Client/css/csharp.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/go.scss b/src/dotnet/APIView/APIViewWeb/Client/css/go.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/java.scss b/src/dotnet/APIView/APIViewWeb/Client/css/java.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/javascript.scss b/src/dotnet/APIView/APIViewWeb/Client/css/javascript.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/json.scss b/src/dotnet/APIView/APIViewWeb/Client/css/json.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/kotlin.scss b/src/dotnet/APIView/APIViewWeb/Client/css/kotlin.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/python.scss b/src/dotnet/APIView/APIViewWeb/Client/css/python.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/swagger.scss b/src/dotnet/APIView/APIViewWeb/Client/css/swagger.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/swift.scss b/src/dotnet/APIView/APIViewWeb/Client/css/swift.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/xml.scss b/src/dotnet/APIView/APIViewWeb/Client/css/xml.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js b/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js index 76bd0ba2a00..0e17e076a75 100644 --- a/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js +++ b/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js @@ -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: { @@ -45,7 +58,7 @@ module.exports = { }, plugins: [ new MiniCssExtractPlugin({ - filename: 'site.css' + filename: "[name].css" }), ], resolve: { diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_Layout.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_Layout.cshtml index 50a89f94ad1..2447ef7111e 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_Layout.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_Layout.cshtml @@ -22,6 +22,21 @@ + @{ + 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"; + + } + } @{ var userPreference = (ViewData["UserPreference"] as UserPreferenceModel) ?? new UserPreferenceModel(); diff --git a/src/dotnet/APIView/APIViewWeb/Properties/launchSettings.json b/src/dotnet/APIView/APIViewWeb/Properties/launchSettings.json index cecaf507ba9..fadd2e7f016 100644 --- a/src/dotnet/APIView/APIViewWeb/Properties/launchSettings.json +++ b/src/dotnet/APIView/APIViewWeb/Properties/launchSettings.json @@ -24,4 +24,4 @@ "applicationUrl": "http://localhost:5000" } } -} \ No newline at end of file +}