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

Commit 49deebb

Browse files
committed
Fixed LessCSS failing on extensionless files
The regex pattern doesn't match filenames that have no extensions, so matching against the pattern returns a `None` object. `None` object doesn't have a `group` property, and therefore an error is thrown. I replaced the regex pattern matching with a `os.path.splitext` call.
1 parent 5e5c5ec commit 49deebb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lesscss/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def get_less(self):
9292
"""
9393
media_dir = self._media
9494
less = []
95-
REGEX = re.compile(r'^.*[.](?P<ext>less|\w+)$', re.I)
9695
for root, dirs, files in os.walk(media_dir):
9796
if self._excluded is not None and isinstance(self._excluded, list):
9897
[dirs.remove(exclude)
@@ -101,7 +100,7 @@ def get_less(self):
101100
less.extend([
102101
os.path.join(root, i)
103102
for i in files
104-
if REGEX.match(i).group('ext') == 'less'
103+
if os.path.splitext(i)[1] == '.less'
105104
])
106105
return less
107106

0 commit comments

Comments
 (0)