The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CSS::Scopifier::Group - Like CSS::Scopifier but can handle rule groups

SYNOPSIS

use CSS::Scopifier::Group;
my $CSS = CSS::Scopifier::Group->read('/path/to/base.css');
$CSS->scopify('.myclass');

# To scopify while also merging 'html' and 'body' into
# the '.myclass' selector rule:
$CSS->scopify('.myclass', merge => ['html','body']);

# New, "scopified" version of the CSS with each rule 
# prepended with '.myclass':
my $newCss = $CSS->write_string;

DESCRIPTION

This module provides exactly the same API as CSS::Scopifier, but is able to handle nested "group" rules, such as:

@media print {
  h5 { 
    font-size: 200%; 
  }
}

It scopifies the inner/nested rules in the same manner as the top-level. Internally, it creates and tracks separate CSS::Scopifier objects for each group/level (which can also be nested multiple levels deep).

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.