Here I'm going to post whatever that is interesting for me. All things about programming using JavaScript and ASP.NET Core. And something else.

A blog about ASP.Net Core and JavaScript

A few days ago I noticed that I forgot some things about how to deal with System.Threading.Tasks.Task objects. So, I have decided to create a short document (or cheat sheet) to refresh Tasks in my memory. Maybe it will come in handy to someone else.

A few days ago I realized that stylesheet on one of my sites wasn't minified. The quick investigation showed that minify option of the webpack css-loader didn’t work anymore. I researched this problem and found that since version 1.0.0 the css-loader doesn't contain the minimize option (see changelog).

In this post, I will show how to keep your CSS minimized by using the PostCSS loader with cssnano.

I will use the Asp.Net Core project, configured as showed in one of my previous posts “Using webpack 4 with ASP.NET Core 2.x MVC application to process ES6 scripts and SASS styles” and will modify it in a proper way.

So, let’s do it.

Couple a days ago I was looking for some information about image uploading from external URL in an ASP.NET Core application. I‘ve found a great post written by Igor Sikorsky (see Sources [1]) and another one, which was written by Andrew Lock (see Sources [2]) who used the same approach.

But in Igor’s post discussion, someone noticed improper using of HttpClient to retrieve the image from external URL. Few seconds googling helped to find another interesting post by Simon Timms [3] which shows how to use HttpClient correctly. He suggests declaring a static instance of HttpClient in the .NET Core application main class.

It is cool, but what if I do not want to use HttpClient as a property of the main app class. What if I want to get it from DI service?

If you are interested in this approach too, welcome to read more…

There are a lot of tutorials, which describe how to perform canvas elements transformations. For example, there is a cool article in the MDN web docs.

But when I tried to create a common function to manipulate the canvas objects, it took a couple of hours to understand how to perform transformations correctly for every canvas object.

 

Ready to get published...

Suppose, you need to deploy your ASP.NET application to the hosting under, let's say, CentOS 7 Linux operating system. As the official documentation says, you have to "Publish the app as a self-contained deployment in Release configuration for the CentOS 7 runtime (centos.7-x64)". It looks quite simple. But to do such publishing, you have to perform some investigations and read a lot of chunks of different articles.

Here, in this post, I suggest a simple step-by-step solution on how to publish your app with easy.

So, let's start.