meson: Rebuild the SCSS-based themes if sassc is available

If we have sassc installed then we want to rebuild the themes that use
SCSS whenever one of their dependencies change.
This commit is contained in:
Emmanuele Bassi 2017-06-01 14:56:32 +01:00
parent 6f71c543e8
commit ee408d5f75
3 changed files with 75 additions and 1 deletions

View File

@ -680,9 +680,24 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
outfile
])
# Re-build the theme files if sassc is available
theme_deps = []
sassc = find_program('sassc', required: false)
if sassc.found()
sassc_opts = [ '-a', '-M', '-t', 'compact' ]
subdir('theme/Adwaita')
subdir('theme/HighContrast')
endif
gtkresources = gnome.compile_resources('gtkresources',
gtk_gresources_xml,
source_dir: meson.current_source_dir(),
dependencies: theme_deps,
source_dir: [
# List in order of preference
meson.current_build_dir(),
meson.current_source_dir(),
],
c_name: '_gtk',
extra_args: '--manual-register')

View File

@ -0,0 +1,30 @@
scss_files = files([
'_colors-public.scss',
'_colors.scss',
'_common.scss',
'_drawing.scss',
])
theme_variants = [
'dark',
]
theme_deps += custom_target('Adwaita',
input: 'gtk-contained.scss',
output: 'gtk-contained.css',
command: [
sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
],
depend_files: scss_files,
build_by_default: true)
foreach variant: theme_variants
theme_deps += custom_target('Adwaita-' + variant,
input: 'gtk-contained-@0@.scss'.format(variant),
output: 'gtk-contained-@0@.css'.format(variant),
command: [
sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
],
depend_files: scss_files,
build_by_default: true)
endforeach

View File

@ -0,0 +1,29 @@
scss_files = files([
'_colors.scss',
'_common.scss',
'_drawing.scss',
])
theme_variants = [
'inverse',
]
theme_deps += custom_target('HighContrast',
input: 'gtk-contained.scss',
output: 'gtk-contained.css',
command: [
sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
],
depend_files: scss_files,
build_by_default: true)
foreach variant: theme_variants
theme_deps += custom_target('HighContrast-' + variant,
input: 'gtk-contained-@0@.scss'.format(variant),
output: 'gtk-contained-@0@.css'.format(variant),
command: [
sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
],
depend_files: scss_files,
build_by_default: true)
endforeach