Skip to content

Commit

Permalink
Added minifier json for scripts and css
Browse files Browse the repository at this point in the history
+Added gitignore
  • Loading branch information
bartimaeusnek committed Jul 2, 2020
1 parent a8eab84 commit 99c0d97
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/CropCalulator/
/.idea/
/.github/
/CropApp/bin/
/CropApp/wwwroot/BreedingDict10000.json
/CropApp/wwwroot/css/site.min.css
/CropApp/wwwroot/js/site.min.js
5 changes: 5 additions & 0 deletions CropApp/CropApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="bundleconfig.json">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions CropApp/Pages/CropCalculation.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
@{
Layout = "_Layout";
}

<environment include="Development">
@section Scripts
{
<script src="~/js/CropList.js"></script>
}

</environment>
<body>
<div class="topmargin7vh">
@{
Expand Down
4 changes: 2 additions & 2 deletions CropApp/Pages/CropList.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Layout = "_Layout";
ViewData["Title"] = "Crop List";
}

<environment include="Development">
@section Scripts
{
<script src="~/js/CropList.js"></script>
}

</environment>
<div>
<h1>@ViewData["Title"]</h1>
<table class="table color-crops table-striped table-bordered table-hover-crops table-responsive table-responsive-y75 max-content">
Expand Down
3 changes: 2 additions & 1 deletion CropApp/Pages/CropPath.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
@{
Layout = "_Layout";
}

<environment include="Development">
@section Scripts
{
<script src="~/js/CropList.js"></script>
<link rel="stylesheet" href="~/css/gridStyles.css"/>
}
</environment>
@{
var ignoredList = ViewContext.HttpContext.Request.Query["ign"].ToString().Split(',').ToList();
var crop = ViewContext.HttpContext.Request.Query["crop"];
Expand Down
17 changes: 13 additions & 4 deletions CropApp/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"] - CropApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="~/css/site.css"/>
<link rel="stylesheet" href="~/css/globalStyles.css"/>
<environment include="Development">
<link rel="stylesheet" href="~/css/site.css"/>
<link rel="stylesheet" href="~/css/globalStyles.css"/>
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="~/css/site.min.css"/>
</environment>
</head>
<body>
<div class="color-crops">
Expand Down Expand Up @@ -52,8 +57,12 @@
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/js/popper.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>

<environment include="Development">
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment exclude="Development">
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
@RenderSection("Scripts", false)
</div>
</body>
Expand Down
22 changes: 22 additions & 0 deletions CropApp/bundleconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"outputFileName": "wwwroot/css/site.min.css",
"inputFiles": [
"wwwroot/css/site.css",
"wwwroot/css/globalStyles.css",
"wwwroot/css/gridStyles.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js",
"wwwroot/js/CropList.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
}
]

0 comments on commit 99c0d97

Please sign in to comment.