rohan2388 / wp-css
Dynamic CSS generator.
Installs: 151
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/rohan2388/wp-css
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-15 04:42:08 UTC
README
v3.0.0
Cached dynamic css
<?php use \RD\WP\Styles; Styles::init(); Styles::add_rule('.text') ->add_prop( 'color', 'red'); ?> <div class="wrapper <?= Styles::class() ?>"> <div class="text"> This text is red. </div> </div> <?php Styles::done(); ?>
Dynamic css
$css = new \RD\WP\CSS(); $css->add_rule() // Select base class ->add_prop('color', '#000000'); $css->add_rule('a') // Select all <a> ->add_prop('text-decoration', 'none');
<?php $css->styles(); // Print style tag ?> <div class="<?php $css->class(); ?>"> <a href="#">This is a link</a> </div>
Inline style
<?php $styles = array( 'color' => 'blue', 'text-decoration' => 'none' ); ?> <a href="#" <?php \RD\WP\CSS::inline( $styles ) ?> >This is a link</a>
TODO
- Fix PHP docBlocks.
- Remove WP from namespace.
- Clean up codes
Changelog
v3.0.0
- Added: A new way to dynamically generate css. It will add all the css in
wp_footersection.
v2.0.0
- Fixed: class name
- Added: Inline style generator
- Some minor changes
v1.0.0
- Initial release