Bundling of CSS/JS files that's configurable in launchSettings.json

If you set BTCPAY_BUDNLEJSCSS to true it'll bundle all JS/CSS files into one

Ref: https://github.com/btcpayserver/btcpayserver/issues/47
This commit is contained in:
lepipele 2018-01-30 12:34:09 -06:00 committed by nicolas.dorier
parent 68ca162dd3
commit 04bce3ae00
8 changed files with 12750 additions and 53 deletions

View file

@ -18,11 +18,13 @@
<EmbeddedResource Include="Currencies.txt" /> <EmbeddedResource Include="Currencies.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="2.6.362" />
<PackageReference Include="Hangfire" Version="1.6.17" /> <PackageReference Include="Hangfire" Version="1.6.17" />
<PackageReference Include="Hangfire.MemoryStorage" Version="1.5.2" /> <PackageReference Include="Hangfire.MemoryStorage" Version="1.5.2" />
<PackageReference Include="Hangfire.PostgreSql" Version="1.4.8.1" /> <PackageReference Include="Hangfire.PostgreSql" Version="1.4.8.1" />
<PackageReference Include="LedgerWallet" Version="1.0.1.32" /> <PackageReference Include="LedgerWallet" Version="1.0.1.32" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" />
<PackageReference Include="Meziantou.AspNetCore.BundleTagHelpers" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" /> <PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.NetCore.Analyzers" Version="2.6.0" /> <PackageReference Include="Microsoft.NetCore.Analyzers" Version="2.6.0" />
<PackageReference Include="NBitcoin" Version="4.0.0.56" /> <PackageReference Include="NBitcoin" Version="4.0.0.56" />

View file

@ -39,6 +39,7 @@ using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.AspNetCore.Mvc.Cors.Internal; using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
using System.Net; using System.Net;
using Meziantou.AspNetCore.BundleTagHelpers;
namespace BTCPayServer.Hosting namespace BTCPayServer.Hosting
{ {
@ -100,6 +101,13 @@ namespace BTCPayServer.Hosting
// l.UseHttps("devtest.pfx", "toto"); // l.UseHttps("devtest.pfx", "toto");
// }); // });
//}); //});
// bundling
services.AddBundles(options =>
{
options.UseMinifiedFiles = Environment.GetEnvironmentVariable("BTCPAY_BUNDLEJSCSS") == "true";
options.AppendVersion = true;
});
} }
// Big hack, tests fails if only call AddHangfire because Hangfire fail at initializing at the second test run // Big hack, tests fails if only call AddHangfire because Hangfire fail at initializing at the second test run

View file

@ -22,7 +22,8 @@
"ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_ENVIRONMENT": "Development",
"BTCPAY_CHAINS": "btc,ltc", "BTCPAY_CHAINS": "btc,ltc",
"BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver", "BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver",
"BTCPAY_INTERNALLIGHTNINGNODE": "http://api-token:foiewnccewuify@127.0.0.1:54938/" "BTCPAY_INTERNALLIGHTNINGNODE": "http://api-token:foiewnccewuify@127.0.0.1:54938/",
"BTCPAY_BUNDLEJSCSS": false
}, },
"applicationUrl": "http://localhost:14142/" "applicationUrl": "http://localhost:14142/"
} }

View file

@ -77,7 +77,7 @@
</div> </div>
<link href="~/vendor/animatecss/animate.css" rel="stylesheet" /> @*<link href="~/vendor/animatecss/animate.css" rel="stylesheet" />*@
<script type="text/javascript"> <script type="text/javascript">
function dismissSyncModal() { function dismissSyncModal() {
$("#modalDialog").addClass('animated bounceOutRight') $("#modalDialog").addClass('animated bounceOutRight')

View file

@ -3,12 +3,12 @@
@inject RoleManager<IdentityRole> RoleManager @inject RoleManager<IdentityRole> RoleManager
@inject BTCPayServer.Services.BTCPayServerEnvironment env @inject BTCPayServer.Services.BTCPayServerEnvironment env
@inject BTCPayServer.HostedServices.NBXplorerDashboard dashboard @inject BTCPayServer.HostedServices.NBXplorerDashboard dashboard
@addTagHelper *, Meziantou.AspNetCore.BundleTagHelpers
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content=""> <meta name="description" content="">
@ -16,23 +16,11 @@
<title>BTCPay Server</title> <title>BTCPay Server</title>
<!-- Bootstrap core CSS --> @* CSS *@
<link href="~/vendor/bootstrap/css/bootstrap.css" rel="stylesheet"> <bundle name="wwwroot/bundles/main/bundle.css" />
<!-- Custom fonts for this template -->
@*<link href="~/vendor/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>*@
<!-- Plugin CSS -->
<link href="~/vendor/magnific-popup/magnific-popup.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="~/css/creative.css" rel="stylesheet" />
<!-- Custom styles for this template -->
<link href="~/css/site.css" rel="stylesheet" />
@* JS *@
<bundle name="wwwroot/bundles/main/bundle.js" />
</head> </head>
<body id="page-top"> <body id="page-top">
@ -50,9 +38,9 @@
<div class="container"> <div class="container">
<a class="navbar-brand js-scroll-trigger" href="~/"> <a class="navbar-brand js-scroll-trigger" href="~/">
<img src="~/img/logo.png" height="45"> <img src="~/img/logo.png" height="45">
@if(env.ChainType != NBXplorer.ChainType.Main) @if (env.ChainType != NBXplorer.ChainType.Main)
{ {
<span class="badge badge-warning" style="font-size:10px;">@env.ChainType.ToString()</span> <span class="badge badge-warning" style="font-size:10px;">@env.ChainType.ToString()</span>
} }
</a> </a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
@ -60,24 +48,24 @@
</button> </button>
<div class="collapse navbar-collapse" id="navbarResponsive"> <div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
@if(SignInManager.IsSignedIn(User)) @if (SignInManager.IsSignedIn(User))
{ {
@if(User.IsInRole(Roles.ServerAdmin)) @if (User.IsInRole(Roles.ServerAdmin))
{ {
<li class="nav-item"><a asp-area="" asp-controller="Server" asp-action="ListUsers" class="nav-link js-scroll-trigger">Server settings</a></li> <li class="nav-item"><a asp-area="" asp-controller="Server" asp-action="ListUsers" class="nav-link js-scroll-trigger">Server settings</a></li>
} }
<li class="nav-item"><a asp-area="" asp-controller="Stores" asp-action="ListStores" class="nav-link js-scroll-trigger">Stores</a></li> <li class="nav-item"><a asp-area="" asp-controller="Stores" asp-action="ListStores" class="nav-link js-scroll-trigger">Stores</a></li>
<li class="nav-item"><a asp-area="" asp-controller="Invoice" asp-action="ListInvoices" class="nav-link js-scroll-trigger">Invoices</a></li> <li class="nav-item"><a asp-area="" asp-controller="Invoice" asp-action="ListInvoices" class="nav-link js-scroll-trigger">Invoices</a></li>
<li class="nav-item"> <li class="nav-item">
<a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage" class="nav-link js-scroll-trigger">My settings</a> <a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage" class="nav-link js-scroll-trigger">My settings</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a asp-area="" asp-controller="Account" asp- asp-action="Logout" title="Manage" class="nav-link js-scroll-trigger">Log out</a> <a asp-area="" asp-controller="Account" asp- asp-action="Logout" title="Manage" class="nav-link js-scroll-trigger">Log out</a>
</li>} </li>}
else else
{ {
<li class="nav-item"><a asp-area="" asp-controller="Account" asp-action="Register" class="nav-link js-scroll-trigger">Register</a></li> <li class="nav-item"><a asp-area="" asp-controller="Account" asp-action="Register" class="nav-link js-scroll-trigger">Register</a></li>
<li class="nav-item"><a asp-area="" asp-controller="Account" asp-action="Login" class="nav-link js-scroll-trigger">Log in</a></li>} <li class="nav-item"><a asp-area="" asp-controller="Account" asp-action="Login" class="nav-link js-scroll-trigger">Log in</a></li>}
</ul> </ul>
</div> </div>
@ -90,20 +78,6 @@
<div class="container text-right"><span style="font-size:8px;">@env.ToString()</span></div> <div class="container text-right"><span style="font-size:8px;">@env.ToString()</span></div>
</footer> </footer>
<!-- Bootstrap core JavaScript -->
<script src="~/vendor/jquery/jquery.min.js"></script>
<script src="~/vendor/popper/popper.min.js"></script>
<script src="~/vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="~/vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="~/vendor/scrollreveal/scrollreveal.min.js"></script>
<script src="~/vendor/magnific-popup/jquery.magnific-popup.min.js"></script>
<!-- Custom scripts for this template -->
<script src="~/js/creative.js"></script>
@if (!dashboard.IsFullySynched()) @if (!dashboard.IsFullySynched())
{ {
@Html.Partial("SyncModal") @Html.Partial("SyncModal")

View file

@ -0,0 +1,24 @@
[
{
"outputFileName": "wwwroot/bundles/main/bundle.css",
"inputFiles": [
"wwwroot/vendor/bootstrap/css/bootstrap.css",
"wwwroot/vendor/magnific-popup/magnific-popup.css",
"wwwroot/css/creative.css",
"wwwroot/css/site.css",
"wwwroot/vendor/animatecss/animate.css"
]
},
{
"outputFileName": "wwwroot/bundles/main/bundle.js",
"inputFiles": [
"wwwroot/vendor/jquery/jquery.js",
"wwwroot/vendor/popper/popper.js",
"wwwroot/vendor/bootstrap/js/bootstrap.js",
"wwwroot/vendor/jquery-easing/jquery.easing.js",
"wwwroot/vendor/scrollreveal/scrollreveal.min.js",
"wwwroot/vendor/magnific-popup/jquery.magnific-popup.js",
"wwwroot/js/creative.js"
]
}
]

File diff suppressed because it is too large Load diff

22
BTCPayServer/wwwroot/bundle.min.css vendored Normal file

File diff suppressed because one or more lines are too long