In my last write-up regarding CodeKit’s Kit Language I mentioned a plug-in (package) for Sublime Text (aka ST) that I had created. Well here it is. A simple plugin/package that will compress any HTML file using the Build System option.
What It Is
The Kit Language will generate static HTML files for you upon save, but what about compression? Well, CodeKit doesn’t provide HTML compression. So you are left using a separate app, or a plugin that resides within the Tools → Build System menu in Sublime Text. But the only plugins I could find for ST generated a renamed file or a file in another folder. But in this scenario, working with the Kit language, a duplicate HTML file is unnecessary, and wastes time. I didn’t want to waste this time, each time a change needs made, to delete the CodeKit compiled HTML files and rename the compressed versions output by ST. So born was the extremely simplistic HTML Compress and Replace.
- In ST, go to Preferences → Browse Packages and take note of the location of this folder.
- Place the HTML Compress and Replace folder in this directory. (You may need to restart ST for it to be available.)
- In ST, go to Tools → Build System and click on HTML Compress and Replace.
- While viewing an HTML file, press F7.
- The window at the bottom of ST will tell you when the build is finished.
- Wait for the view to refresh or simply click on another tab or file and then click back to view the compressed HTML.