Permalink
Browse files

Fix getting node path from settings

1 parent debf091 commit 6092faf9ecca88f82956fd652165122512b3550c @tonyganch tonyganch committed Feb 3, 2015
Showing with 8 additions and 9 deletions.
  1. +5 −8 CSScomb.py
  2. +3 −1 CSScomb.sublime-settings
View
@@ -39,9 +39,8 @@ def run(self, edit):
def comb(self, css, syntax, config):
config = json.dumps(config)
folder = os.path.dirname(self.view.file_name())
- node = self.get_node()
try:
- p = Popen([node, COMB_PATH] + [syntax, config, folder],
+ p = Popen(['node', COMB_PATH] + [syntax, config, folder],
stdout=PIPE, stdin=PIPE, stderr=PIPE,
env=self.get_env(), shell=self.is_windows())
except OSError:
@@ -57,9 +56,12 @@ def get_env(self):
env = None
if self.is_osx():
env = os.environ.copy()
- env['PATH'] += ':/usr/local/bin'
+ env['PATH'] += self.get_node_path()
return env
+ def get_node_path(self):
+ return self.get_settings().get('node-path')
+
def get_settings(self):
settings = self.view.settings().get('CSScomb')
if settings is None:
@@ -71,11 +73,6 @@ def get_config(self):
config = settings.get('config')
return config
- def get_node(self):
- settings = self.get_settings()
- node = settings.get('node')
- return node
-
def get_syntax(self):
if self.is_css():
return 'css'
@@ -1,5 +1,7 @@
{
- "node" : "/usr/local/bin",
+ // If plugin has trouble finding Node.js, replace this string with path
+ // to your `node` bin
+ "node-path" : ":/usr/local/bin",
// Full list of supported options and acceptable values can be found here:
// https://github.com/csscomb/csscomb.js/blob/master/doc/options.md

0 comments on commit 6092faf

Please sign in to comment.