Skip to content
This repository was archived by the owner on Jun 28, 2018. It is now read-only.

Commit 64f2828

Browse files
committed
Merge pull request #3 from psychowico/master
Multiple less files error and directory dependencies
2 parents 473404f + 7ab0b82 commit 64f2828

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lesscss/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def compile(self):
122122
filename = os.path.splitext(i)[0]
123123
css = '%s.css' % filename
124124
if self._output:
125-
css = css.split('/')[-1]
125+
css = os.path.relpath(css, self._media)
126126
css = '%s/%s' % (self._output, css)
127127
css_time = -1 # Poor man's Integer.MIN_VALUE
128128
if os.path.isfile(css):
@@ -131,13 +131,17 @@ def compile(self):
131131
if less_time >= css_time:
132132
command_opt.append(i)
133133
command_opt.append(css)
134+
css_dir = os.path.dirname(css)
135+
if not os.path.exists(css_dir):
136+
os.makedirs(css_dir)
134137
subprocess.call(command_opt, shell=False)
135138
if self._based:
136139
del command_opt[-1]
137140
css_based = '%s-%s.css' % (filename,
138141
LessCSS.to60(uuid4().time_low))
139142
if self._output:
140-
css_based = css_based.split('/')[-1]
143+
css_based = os.path.relpath(css_based, self._media)
141144
css_based = '%s/%s' % (self._output, css_based)
142145
command_opt.append(css_based)
143146
subprocess.call(command_opt, shell=False)
147+
del command_opt[-2:]

0 commit comments

Comments
 (0)