Changeset 56574
- Timestamp:
- 09/14/2023 04:54:22 AM (3 weeks ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r56568 r56574 3054 3054 * 3055 3055 * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. 3056 * Default true.3056 * Default false. 3057 3057 * @type bool $prettify Whether to add new lines and indents to output. 3058 3058 * Default to whether the `SCRIPT_DEBUG` constant is defined. -
trunk/src/wp-includes/style-engine.php
r55820 r56574 131 131 * When set, the style engine will attempt to store the CSS rules. 132 132 * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. 133 * Default true.133 * Default false. 134 134 * @type bool $prettify Whether to add new lines and indents to output. 135 135 * Defaults to whether the `SCRIPT_DEBUG` constant is defined. … … 179 179 * 180 180 * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. 181 * Default true.181 * Default false. 182 182 * @type bool $prettify Whether to add new lines and indents to output. 183 183 * Defaults to whether the `SCRIPT_DEBUG` constant is defined. -
trunk/src/wp-includes/style-engine/class-wp-style-engine-processor.php
r55820 r56574 86 86 * 87 87 * @since 6.1.0 88 * @since 6.4.0 The Optimization is no longer the default. 88 89 * 89 90 * @param array $options { … … 91 92 * 92 93 * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. 93 * Default true.94 * Default false. 94 95 * @type bool $prettify Whether to add new lines and indents to output. 95 96 * Defaults to whether the `SCRIPT_DEBUG` constant is defined. … … 99 100 public function get_css( $options = array() ) { 100 101 $defaults = array( 101 'optimize' => true,102 'optimize' => false, 102 103 'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG, 103 104 ); -
trunk/src/wp-includes/style-engine/class-wp-style-engine.php
r56046 r56574 625 625 * When set, the style engine will attempt to store the CSS rules. 626 626 * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. 627 * Default true.627 * Default false. 628 628 * @type bool $prettify Whether to add new lines and indents to output. 629 629 * Defaults to whether the `SCRIPT_DEBUG` constant is defined. -
trunk/tests/phpunit/tests/style-engine/styleEngine.php
r56046 r56574 655 655 * Tests that incoming styles are deduped and merged. 656 656 * 657 * @ticket 58811 657 658 * @ticket 56467 658 659 * … … 698 699 $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules, array( 'prettify' => false ) ); 699 700 700 $this->assertSame( '.gandalf{color:white;height:190px;border-style:dotted;padding:10px;margin-bottom:100px;}.dumbledore ,.rincewind{color:grey;height:90px;border-style:dotted;}', $compiled_stylesheet );701 $this->assertSame( '.gandalf{color:white;height:190px;border-style:dotted;padding:10px;margin-bottom:100px;}.dumbledore{color:grey;height:90px;border-style:dotted;}.rincewind{color:grey;height:90px;border-style:dotted;}', $compiled_stylesheet ); 701 702 } 702 703 } -
trunk/tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php
r54394 r56574 82 82 $a_wonderful_processor->add_rules( array( $a_wonderful_css_rule, $a_very_wonderful_css_rule, $a_more_wonderful_css_rule ) ); 83 83 84 $expected = '.a-more-wonderful-rule { 84 $expected = '.a-wonderful-rule { 85 color: var(--wonderful-color); 86 background-color: orange; 87 } 88 .a-very_wonderful-rule { 89 color: var(--wonderful-color); 90 background-color: orange; 91 } 92 .a-more-wonderful-rule { 85 93 font-family: Wonderful sans; 86 94 font-size: 1em; 87 background-color: orange;88 }89 .a-wonderful-rule,90 .a-very_wonderful-rule {91 color: var(--wonderful-color);92 95 background-color: orange; 93 96 } … … 185 188 * Tests printing out 'unoptimized' CSS, that is, uncombined selectors and duplicate CSS rules. 186 189 * 190 * This is the default. 191 * 192 * @ticket 58811 187 193 * @ticket 56467 188 194 * … … 231 237 * Tests that 'optimized' CSS is output, that is, that duplicate CSS rules are combined under their corresponding selectors. 232 238 * 233 * @ticket 56467 234 * 235 * @covers ::get_css 236 */ 237 public function test_should_optimize_css_output_by_default() { 239 * @ticket 58811 240 * @ticket 56467 241 * 242 * @covers ::get_css 243 */ 244 public function test_should_not_optimize_css_output_by_default() { 238 245 $a_sweet_rule = new WP_Style_Engine_CSS_Rule( 239 246 '.a-sweet-rule', … … 256 263 257 264 $this->assertSame( 258 '.a-sweet-rule ,#an-even-sweeter-rule > marquee{color:var(--sweet-color);background-color:purple;}',265 '.a-sweet-rule{color:var(--sweet-color);background-color:purple;}#an-even-sweeter-rule > marquee{color:var(--sweet-color);background-color:purple;}', 259 266 $a_sweet_processor->get_css( array( 'prettify' => false ) ) 260 267 ); … … 262 269 263 270 /** 264 * Tests that incoming CSS rules are merged with existing CSS rules. 265 * 271 * Tests that incoming CSS rules are optimized and merged with existing CSS rules. 272 * 273 * @ticket 58811 266 274 * @ticket 56467 267 275 * … … 287 295 $this->assertSame( 288 296 '.a-lovely-rule,.a-lovelier-rule{border-color:purple;}', 289 $a_lovely_processor->get_css( array( 'prettify' => false ) ), 297 $a_lovely_processor->get_css( 298 array( 299 'prettify' => false, 300 'optimize' => true, 301 ) 302 ), 290 303 'Return value of get_css() does not match expectations when combining 2 CSS rules' 291 304 ); … … 309 322 $this->assertSame( 310 323 '.a-lovely-rule,.a-lovelier-rule,.a-most-lovely-rule,.a-perfectly-lovely-rule{border-color:purple;}', 311 $a_lovely_processor->get_css( array( 'prettify' => false ) ), 324 $a_lovely_processor->get_css( 325 array( 326 'prettify' => false, 327 'optimize' => true, 328 ) 329 ), 312 330 'Return value of get_css() does not match expectations when combining 4 CSS rules' 313 331 );
Note: See TracChangeset
for help on using the changeset viewer.