build: switch CSS files to SCSS (#49776)

This commit is contained in:
Frédéric Péters 2020-12-29 17:44:35 +01:00
parent bce5d8faae
commit 6f99df0ff8
6 changed files with 38 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
*.pyc
local_settings.py
/wcs/qommon/static/css/dc2/admin.css
/wcs/qommon/static/css/qommon.css

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 *.png *.gif *.jpg *.js *.eot *.svg *.ttf *.woff
recursive-include wcs/qommon/static/ *.css *.scss *.png *.gif *.jpg *.js *.eot *.svg *.ttf *.woff
recursive-include wcs/templates *.html *.txt
recursive-include wcs/qommon/templates *.html *.txt

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: wcs
Section: web
Priority: optional
Maintainer: Frederic Peters <fpeters@debian.org>
Build-Depends: python3-quixote, debhelper (>= 9), python3-all, dh-python, dh-systemd, python3-setuptools, gettext, python3-gadjo
Build-Depends: python3-quixote, debhelper (>= 9), python3-all, dh-python, dh-systemd, python3-setuptools, gettext, python3-gadjo, sassc
Standards-Version: 3.9.6.0
Homepage: https://dev.entrouvert.org/projects/wcs/

View File

@ -5,6 +5,8 @@ import subprocess
import sys
from distutils.cmd import Command
from distutils.errors import CompileError
from distutils.spawn import find_executable
from distutils.command.build import build as _build
from distutils.command.sdist import sdist
from setuptools.command.install_lib import install_lib as _install_lib
@ -40,8 +42,38 @@ class compile_translations(Command):
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
class compile_scss(Command):
description = 'compile scss files into css files'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
sass_bin = None
for program in ('sassc', 'sass'):
sass_bin = find_executable(program)
if sass_bin:
break
if not sass_bin:
raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.')
for path, dirnames, filenames in os.walk('wcs'):
for filename in filenames:
if not filename.endswith('.scss'):
continue
if filename.startswith('_'):
continue
subprocess.check_call([sass_bin, '%s/%s' % (path, filename),
'%s/%s' % (path, filename.replace('.scss', '.css'))])
class build(_build):
sub_commands = [('compile_translations', None)] + _build.sub_commands
sub_commands = [('compile_translations', None),
('compile_scss', None) ] + _build.sub_commands
class install_lib(_install_lib):
@ -104,9 +136,9 @@ def get_version():
return '0.0'
cmdclass = {
'build': build,
'compile_scss': compile_scss,
'compile_translations': compile_translations,
'install_lib': install_lib,
'sdist': eo_sdist