We create many websites and use many themes and CSS files in our work. All new ideas require CSS optimizations to adjust look and feel. Latest SEO practices suggest to minify everything possible on your website from CSS to HTML.
If you are using some software to edit your HTML files than maybe it has some autominifying plugins available. We mostly use Notepad++ for work and thus have the following options:
rem Try to exit early if no file exists if not exist %1 ( echo file does not exist %1 goto :eof ) set nam=%~n1 set ext=%~x1 set fullpath=%~dp1 set do_minify="0" set full_min=%fullpath%\%nam%.min%ext% rem echo %fullpath% if "%ext%"==".js" ( set do_minify=1 ) if "%ext%"==".css" ( set do_minify=1 ) if "%do_minify%"=="1" ( if "%full_min%"=="" ( echo Wrong with %full_min% goto :eof ) minify.cmd -o %full_min% %1 ) else ( echo This is not a file to minify: %1 )
npm install minifier -g
Save the script as “Minify”
Choose Minify under Associated script, press Add/Modify button.
Choose “Place to the Macros menu”.
Ok, restart Notepad++.
Macro -> Modify shortcut/Delete Macro …
Under the tab “Plugin Commands”, double click on Minify.
Choose F9 (or some other button) as a shortcut.
Then when you press F9 in Notepad++, the script will create a new minified file that takes less space on a disk and is downloaded faster by browsers.