build: generate sourcemap for CSS files (#49794)

This commit is contained in:
Frédéric Péters 2020-12-31 14:48:38 +01:00
parent a58551e616
commit 8d33aa0e82
2 changed files with 9 additions and 9 deletions

View File

@ -7,6 +7,6 @@ recursive-include data/web/ *.html *.css *.png
recursive-include data/themes/default/ *.html *.css *.png *.gif *.jpg *.js *.ezt *.xml
recursive-include data/themes/alto/ *.html *.css *.png *.gif *.jpg *.js *.ezt *.xml
recursive-include data/vendor/ *.dat
recursive-include wcs/qommon/static/ *.css *.scss *.png *.gif *.jpg *.js *.eot *.svg *.ttf *.woff
recursive-include wcs/qommon/static/ *.css *.scss *.png *.gif *.jpg *.js *.eot *.svg *.ttf *.woff *.map
recursive-include wcs/templates *.html *.txt
recursive-include wcs/qommon/templates *.html *.txt

View File

@ -53,13 +53,9 @@ class compile_scss(Command):
pass
def run(self):
sass_bin = None
for program in ('sassc', 'sass'):
sass_bin = find_executable(program)
if sass_bin:
break
sass_bin = find_executable('sassc')
if not sass_bin:
raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.')
raise CompileError('sassc is required but was not found.')
for path, dirnames, filenames in os.walk('wcs'):
for filename in filenames:
@ -67,7 +63,10 @@ class compile_scss(Command):
continue
if filename.startswith('_'):
continue
subprocess.check_call([sass_bin, '%s/%s' % (path, filename),
subprocess.check_call([
sass_bin,
'--sourcemap',
'%s/%s' % (path, filename),
'%s/%s' % (path, filename.replace('.scss', '.css'))])
@ -97,7 +96,8 @@ class eo_sdist(sdist):
def data_tree(destdir, sourcedir):
extensions = ['.css', '.png', '.jpeg', '.jpg', '.gif', '.xml', '.html',
'.js', '.ezt', '.dat', '.eot', '.svg', '.ttf', '.woff']
'.js', '.ezt', '.dat', '.eot', '.svg', '.ttf', '.woff', '.scss',
'.map']
r = []
for root, dirs, files in os.walk(sourcedir):
l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]