diff --git a/pkg/web_css/lib/style.scss b/pkg/web_css/lib/style.scss index 58b25d54bd..4eeff363e6 100644 --- a/pkg/web_css/lib/style.scss +++ b/pkg/web_css/lib/style.scss @@ -9,6 +9,7 @@ // Local styles and rules. @use 'src/_variables'; @use 'src/_base'; +@use 'src/_alerts'; @use 'src/_site_header'; @use 'src/_activity_log'; @use 'src/_detail_page'; @@ -20,6 +21,6 @@ @use 'src/_report'; @use 'src/_scores'; @use 'src/_search'; -@use 'src/_staging_ribbon.scss'; +@use 'src/_staging_ribbon'; @use 'src/_tags'; @use 'src/_topics'; diff --git a/pkg/web_css/pubspec.yaml b/pkg/web_css/pubspec.yaml index c0c64828b6..9bd0ae2f87 100644 --- a/pkg/web_css/pubspec.yaml +++ b/pkg/web_css/pubspec.yaml @@ -10,4 +10,5 @@ dependencies: dev_dependencies: csslib: ^1.0.0 + path: ^1.9.1 test: ^1.16.5 diff --git a/pkg/web_css/test/file_use_test.dart b/pkg/web_css/test/file_use_test.dart new file mode 100644 index 0000000000..211fb3a272 --- /dev/null +++ b/pkg/web_css/test/file_use_test.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:path/path.dart' as p; +import 'package:test/test.dart'; + +void main() { + test('scss files in lib/ are exactly those referenced by style.scss ', + () async { + final references = (await File('lib/style.scss').readAsLines()) + .where((l) => l.startsWith(r'@use')) + .map((l) => + l.substring(4).trim().split(';').first.replaceAll("'", '').trim()) + .where((v) => v.isNotEmpty) + .toSet(); + expect(references, isNotEmpty); + expect(references, contains('src/_tags')); + + final files = Directory('lib') + .listSync(recursive: true) + .whereType() + .where((f) => f.path.endsWith('.scss')) + .map((f) => p.relative(f.path, from: 'lib')) + .map((n) => n.substring(0, n.length - 5)) // without the .scss extension + .toSet(); + files.removeAll(['dartdoc', 'style']); + expect(files, isNotEmpty); + expect(references, files); + }); +}