Skip to content
Open
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
15 changes: 13 additions & 2 deletions SassBeautify.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def on_post_save(self, view):
'''
settings = sublime.load_settings('SassBeautify.sublime-settings')
beautify_on_save = settings.get('beautifyOnSave', False)
project_data = sublime.active_window().project_data()
if project_data:
project_settings = project_data.get('SassBeautify', {})
if 'beautifyOnSave' in project_settings:
beautify_on_save = project_settings['beautifyOnSave']

if not SassBeautifyCommand.saving and beautify_on_save:
view.run_command('sass_beautify', {
Expand All @@ -101,6 +106,12 @@ def run(self, edit, action='beautify', convert_from_type=None, show_errors=True)
self.settings = sublime.load_settings('SassBeautify.sublime-settings')
self.show_errors = show_errors

project_data = sublime.active_window().project_data()
if project_data:
project_settings = project_data.get('SassBeautify', {})
for k,v in project_settings.items():
self.settings.set(k, v)

if self.check_file():
self.beautify()

Expand Down Expand Up @@ -173,7 +184,7 @@ def insert_newline_between_capturing_parentheses(m):
content = re.sub(re.compile('(;.*|}.*)(\n +//.*\n.+[{,])$', re.MULTILINE), insert_newline_between_capturing_parentheses, content)

return content

def use_single_quotes(self, content):
content = content.replace('"', '\'')
return content
Expand Down Expand Up @@ -229,7 +240,7 @@ def handle_process(self, returncode, output, error):

if self.settings.get('newlineBetweenSelectors', False):
output = self.beautify_newlines(output)

if self.settings.get('useSingleQuotes', False):
output = self.use_single_quotes(output)

Expand Down