Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Dealing static files in Production mode

$
0
0

Hi,

I can't figure out how I am supposed to handle static files in different modes (I work with VSTS Ci/Cd using Docker)

Considering the following use case (_Layout.cshtml) :

@* CSS *@<environment names="Development"><link rel="stylesheet" href="~/css/bootstrap-flatly.css" /></environment><environment names="Staging,Production"><link rel="stylesheet" href="https://bootswatch.com/3/flatly/bootstrap.min.css"
              asp-fallback-href="~/css/bootstrap-flatly.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" /></environment>

@* JS *@
<environment names="Development"><script src="~/lib/jquery/dist/jquery.js"></script></environment><environment names="Staging,Production"><script src="https://code.jquery.com/jquery-3.2.1.min.js"
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="></script></environment>

If I'am in Staging or Production Env, the CDN are called first, then a fallback allows to load lib from the published  local wwwroot/lib/ folder.

Right, if CDN fails, the fallback is called, but how these libs are supposed to be published on my server ? I guess that tracking all the files within git and push them on my remotes branches and then let my Ci/Cd pipeline (VSTS ) publish themis not the correct way.

Should we execute a bower, or npm or whatever script command after publishing the application on the remote server in order to automatically get all static files dependencies  ?

Another point : as CDN url are set in the code, they may not match with my local libraries (updated with bower), so there could be version differences between my CDN and local lib, is it an acceptable point, what is the pros and the cons about that, I don't understand ?

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>