jaspr_class_scope_builder 0.1.0
jaspr_class_scope_builder: ^0.1.0 copied to clipboard
Build-time generator for jaspr_class_scope: gives every Jaspr component locally scoped CSS class names, so one component's styles cannot reach another.
Example #
// lib/components/hero.dart
import 'package:jaspr_class_scope/jaspr_class_scope.dart';
part 'hero.scopes.dart';
@scopedCss
class Hero extends StatelessComponent {
static const _class = _$HeroScope;
static final _grid = _class('grid');
@css
static List<StyleRule> get styles => [
css(_grid.selector).styles(display: Display.grid),
];
@override
Component build(BuildContext context) => div(classes: _grid.name, []);
}
dart run build_runner build writes the scope next to it, and _grid renders
as grid-lz7xyh. See the package readme.