The console application will read the settings value from a setting.config file. It will have three settings which are listed and explained below.
This setting is used to determined the location of the files that you want to minify. You can specify more than 1 location path.
This setting is used to what types of file extensions you want to include in minification process.
The concept of this console application is pretty simple. It basically will get the files based on the source of directory you provide and using the built in .Net framework to perform the search of the files pattern. It will use the GetFiles function. I created another blog article about this function, you can check it out by clicking this link.
Here is the console application code. It uses the .Net Regular Expression to remove any comments and new line or tabs that are not needed when minifying a file.
This is a sample setting.config file information.
There are more improvements needed on this application such as checking whether the settings information have been provided or whether the settings are correct, or maybe even in minifying the file process, etc. Feel free to improve it and hopefully it will be useful for your development journey.
How to use this minify console application?
In the zip file, under the bin/release folder, there is an executable file. You can double click this executable files to run the program. Before running this console program. Make sure you check the config setting and ensure the directory path exists.
See below an example of the console application screenshot when the minification process is completed.
Allows you to get the highest or lowest number from a list of line numbers.