Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic CSSComb on save #91

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CSScomb.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// to your `node` bin
"node-path" : ":/usr/local/bin",

// If you want to run CSScomb on save
"on-save" : false,

// Full list of supported options and acceptable values can be found here:
// https://github.com/csscomb/csscomb.js/blob/master/doc/options.md
"config": {
Expand Down
18 changes: 18 additions & 0 deletions CSScombEventListener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sublime, sublime_plugin

class CSScombEventListener(sublime_plugin.EventListener):
@staticmethod
def on_pre_save(view):
if not CSScombEventListener.get_settings(view).get('on-save'):
return

view.window().run_command('css_comb')

@staticmethod
def get_settings(view):
settings = view.settings().get('CSScomb')

if settings is None:
settings = sublime.load_settings('CSScomb.sublime-settings')

return settings