Skip to content

Commit

Permalink
Made the plugin ST2/ST3 compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbusser-itouch committed May 14, 2013
1 parent 1ad6ced commit 1e6cadb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ pip-log.txt

#Mr Developer
.mr.developer.cfg
lesscompiler.py.orig
5 changes: 4 additions & 1 deletion less2css.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import sublime
import sublime_plugin
import os
from . import lesscompiler
try:
import lesscompiler
except ImportError:
from . import lesscompiler


#message window
Expand Down
16 changes: 8 additions & 8 deletions lesscompiler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import sublime
#import sublime_plugin
import subprocess
Expand All @@ -14,8 +15,9 @@ def __init__(self, view):

def getSettings(self):
# get the user settings for the plugin
settings = sublime.active_window().active_view().settings() \
.get("less2css", sublime.load_settings('less2css.sublime-settings'))
#settings = sublime.active_window().active_view().settings() \
# .get("less2css", sublime.load_settings('less2css.sublime-settings'))
settings = sublime.load_settings('less2css.sublime-settings')

return {
'auto_compile': settings.get("autoCompile", True),
Expand Down Expand Up @@ -45,7 +47,7 @@ def convertOne(self, is_auto_save=False):
# check if files starting with an underscore should be ignored and if the file name starts with an underscore
if (settings['ignore_underscored'] and os.path.basename(fn).startswith('_') and is_auto_save):
# print a friendly message for the user
print "[less2css] '" + fn + "' ignored, file name starts with an underscore and ignorePrefixedFiles is True"
print("[less2css] '" + fn + "' ignored, file name starts with an underscore and ignorePrefixedFiles is True")
return ''

dirs = self.parseBaseDirs(settings['base_dir'], settings['output_dir'])
Expand Down Expand Up @@ -75,7 +77,7 @@ def convertAll(self):
# check if files starting with an underscore should be ignored and if the file name starts with an underscore
if (settings['ignore_underscored'] and files.startswith('_')):
# print a friendly message for the user
print "[less2css] '" + os.path.join(r, files) + "' ignored, file name starts with an underscore and ignorePrefixedFiles is True"
print("[less2css] '" + os.path.join(r, files) + "' ignored, file name starts with an underscore and ignorePrefixedFiles is True")
else:
# add path to file name
fn = os.path.join(r, files)
Expand Down Expand Up @@ -153,7 +155,7 @@ def convertLess2Css(self, lessc_command, dirs, file='', minimised=True, outputFi
# the call for non minified CSS is the same on all platforms
cmd = [lessc_command, less, css, "--verbose"]

print("[less2css] Converting", less, "to", css)
print("[less2css] Converting " + less + " to " + css)

# check if we're compiling with the default compiler
if lessc_command == "lessc":
Expand Down Expand Up @@ -190,12 +192,10 @@ def convertLess2Css(self, lessc_command, dirs, file='', minimised=True, outputFi

# if out is empty it means the LESS file was succesfuly compiled to CSS, else we will print the error
if out == '':
print '[less2css] Convert completed!'
print('[less2css] Convert completed!')
else:
print('----[less2cc] Compile Error----')
print(out)
else:
print('[less2css] Convert completed!')

return out

Expand Down

0 comments on commit 1e6cadb

Please sign in to comment.