[FIX] Do not top up all @imports before less/sass compilation

This was preventing the bundles fragments to be restored after
compilation
This commit is contained in:
Fabien Meghazi
2014-08-13 11:02:43 +02:00
parent e081fd0df4
commit ea3cb1f55e
+5 -5
View File
@@ -1172,17 +1172,17 @@ class AssetsBundle(object):
command = to_compile[0].get_command()
source = '\n'.join([asset.get_source() for asset in to_compile])
# move up all @import rules to the top and exclude file imports
# sanitize @import rules and avoid duplicates imports
imports = []
def push(matchobj):
def sanitize(matchobj):
# TODO: check if a duplicate removal opt-out is necessary
ref = matchobj.group(2)
line = '@import "%s"%s' % (ref, matchobj.group(3))
if '.' not in ref and line not in imports and not ref.startswith(('.', '/', '~')):
imports.append(line)
return line
return ''
source = re.sub(self.rx_preprocess_imports, push, source)
imports.append(source)
source = u'\n'.join(imports)
source = re.sub(self.rx_preprocess_imports, sanitize, source)
try:
compiler = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE)