build: Make sassc mandatory and always generate CSS files from Sass sources

The previous implementation of the CSS generation logic considered sassc
an optional dependency and made sure for that reason that the result CSS
files ended up in the source directory, so that they could be checked
in and kept in sync with the source sass files.

As we are making sassc a required dependency, we can now stop doing that
extra work and simply rely on the CSS files being automatically generated
each time the sass sources change. By doing this, we can now effectively
get rid of the CSS files checked in the repo as well as of the parse_sass.sh
script, since the CSS files will now live on the build directory only.

https://bugzilla.gnome.org/show_bug.cgi?id=792822
This commit is contained in:
Mario Sanchez Prada 2018-02-07 12:31:50 +00:00
parent 92f1aec3dd
commit c62e7a6a82
6 changed files with 19 additions and 3819 deletions

View File

@ -1,12 +1,9 @@
Summary Summary
------- -------
* Do not edit the CSS directly, edit the source SCSS files and process them with SASS (running * Do not edit the CSS directly, edit the source SCSS files and the CSS files will be generated
`make` should do that when you have the required software installed, as described below; automatically when building with meson + ninja and left inside the build directory to be
run `./parse-sass.sh` manually if it doesn't) incorporated into the gresource XML (you'll need to have sassc installed).
* Most SASS preprocessors should produce similar results, however the build system
integration and 'parse-sass.sh' script use sassc. You should be able to install
it with `pkcon install sassc` or your distribution's package manager.
How to tweak the theme How to tweak the theme
---------------------- ----------------------
@ -31,4 +28,4 @@ _common.scss - actual definitions of style for each widget. This is where
your changes. your changes.
You can read about SASS at http://sass-lang.com/documentation/. Once you make your changes to the You can read about SASS at http://sass-lang.com/documentation/. Once you make your changes to the
_common.scss file, you can either run make or the ./parse-sass.sh script. _common.scss file, you can run ninja to generate the final CSS files.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,15 +7,21 @@ theme_sources = files([
'gnome-shell-sass/_high-contrast-colors.scss' 'gnome-shell-sass/_high-contrast-colors.scss'
]) ])
styles = [
'gnome-shell-high-contrast',
'gnome-shell'
]
theme_deps = [] theme_deps = []
if sassc.found() if sassc.found()
parse_sass = files('parse-sass.sh') foreach style: styles
theme_deps += custom_target('style-' + style,
theme_deps += custom_target('update-theme', input: '@0@.scss'.format(style),
output: 'theme-update.stamp', output: '@0@.css'.format(style),
depend_files: theme_sources, command: [
command: [parse_sass, '@OUTPUT@'], sassc, '-a', '@INPUT@', '@OUTPUT@'
build_by_default: true ],
) depend_files: theme_sources)
endforeach
endif endif

View File

@ -1,10 +0,0 @@
#!/bin/sh
srcdir=`dirname $0`
stamp=${1}
for scss in $srcdir/*.scss
do
sassc -a $scss ${scss%%.scss}.css || exit 1
done
[ "$stamp" ] && touch $stamp

View File

@ -138,7 +138,7 @@ endif
mutter_typelibdir = mutter_dep.get_pkgconfig_variable('typelibdir') mutter_typelibdir = mutter_dep.get_pkgconfig_variable('typelibdir')
python = find_program('python3') python = find_program('python3')
sassc = find_program('sassc', required: false) sassc = find_program('sassc', required: true)
cc = meson.get_compiler('c') cc = meson.get_compiler('c')