Skip to content

Commit

Permalink
Merge pull request #74 from mrjoelkemp/fix_sass_root
Browse files Browse the repository at this point in the history
Add a trailing slash to all roots.
  • Loading branch information
mrjoelkemp committed Dec 12, 2014
2 parents ed45288 + 5a578da commit 596a860
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 0 additions & 3 deletions Dependents.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ def run(self, modifier=''):
settings = get_project_settings(base_path)

self.window.root = settings['root']
if self.window.root[-1] != '/':
self.window.root += '/'

self.window.config = settings['config']
self.window.sass_root = settings['sass_root']

Expand Down
7 changes: 2 additions & 5 deletions JumpToDependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ def run(self):

settings = get_project_settings(base_path)

self.window.root = settings['root']
self.window.sass_root = settings['sass_root']

if self.window.root[-1] != '/':
self.window.root += '/'
self.window.root = settings['root']
self.window.sass_root = settings['sass_root']

if self.window.root == './' or self.window.root == '.':
self.window.root = base_path
Expand Down
12 changes: 10 additions & 2 deletions project_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
def get_settings_from_source(source):
settings = {}

settings['root'] = source.get('root', '')
settings['root'] = normalize_trailing_slash(source.get('root', ''))
settings['sass_root'] = normalize_trailing_slash(source.get('sass_root', ''))
settings['config'] = source.get('config', '')
settings['sass_root'] = source.get('sass_root', '')

return settings

def normalize_trailing_slash(string):
normalized = string

if normalized and normalized[-1] != '/':
normalized += '/'

return normalized

def get_project_settings(base_path):
"""
Returns a settings map that contains project settings
Expand Down

0 comments on commit 596a860

Please sign in to comment.