Skip to content

Instantly share code, notes, and snippets.

@muya muya/minify_on_save.py
Last active Mar 4, 2017

Embed
What would you like to do?
Sublime Text 3 Plugin to Minify JS & CSS files on save (requires bistory's Sublime Minifier here: https://github.com/bistory/Sublime-Minifier)
import sublime, sublime_plugin
class MinifyOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
file_types_to_minify = ['js', 'css']
filenameParts = view.file_name().split('.')
if filenameParts[len(filenameParts) - 1] in file_types_to_minify:
view.run_command('minify')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.