Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Revert "Use ponyfill instead of postcss to address IE."
Browse files Browse the repository at this point in the history
This reverts commit d361c1a.
  • Loading branch information
jffng committed Oct 1, 2020
1 parent d361c1a commit a50f356
Show file tree
Hide file tree
Showing 12 changed files with 8,713 additions and 1,026 deletions.
2,089 changes: 2,089 additions & 0 deletions assets/css/ie-editor.css

Large diffs are not rendered by default.

5,640 changes: 5,640 additions & 0 deletions assets/css/ie.css

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions assets/js/css-vars-ponyfill2.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/ie11-fix.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/sass/03-generic/ie11.scss

This file was deleted.

2 changes: 0 additions & 2 deletions assets/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* Vertical-margins.....Vertical spacing for the main components.
* Reset................Reset specific elements to make them easier to style in other contexts.
* Clearings............Clearnings for the main components.
* IE11.................Add the ponyfill for IE11.
*
* ELEMENTS
* Blockquote...........Default blockquote.
Expand Down Expand Up @@ -91,7 +90,6 @@
@import "03-generic/vertical-margins";
@import "03-generic/reset";
@import "03-generic/clearings";
@import "03-generic/ie11";

/* Category 04 can contain any default HTML element. Do not add classes here, just give the elements some basic styles. */
@import "04-elements/blockquote";
Expand Down
32 changes: 20 additions & 12 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,17 @@ function twenty_twenty_one_setup() {
// Add support for editor styles.
add_theme_support( 'editor-styles' );

$editor_stylesheet_path = './assets/css/style-editor.css';

// Note, the is_IE global variable is defined by WordPress and is used
// to detect if the current browser is internet explorer.
global $is_IE;
if ( $is_IE ) {
$editor_stylesheet_path = './assets/css/ie-editor.css';
}

// Enqueue editor styles.
add_editor_style( './assets/css/style-editor.css' );
add_editor_style( $editor_stylesheet_path );

// Add custom editor font sizes.
add_theme_support(
Expand Down Expand Up @@ -317,8 +326,16 @@ function twenty_twenty_one_content_width() {
* Enqueue scripts and styles.
*/
function twenty_twenty_one_scripts() {
// Theme styles.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
// Note, the is_IE global variable is defined by WordPress and is used
// to detect if the current browser is internet explorer.
global $is_IE;
if ( $is_IE ) {
// If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) );
} else {
// If not IE, use the standard stylesheet.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
}

// RTL styles.
wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' );
Expand All @@ -335,15 +352,6 @@ function twenty_twenty_one_scripts() {
if ( has_nav_menu( 'primary' ) ) {
wp_enqueue_script( 'twenty-twenty-one-primary-navigation-script', get_template_directory_uri() . '/assets/js/primary-navigation.js', array(), wp_get_theme()->get( 'Version' ), true );
}

// Note, the is_IE global variable is defined by WordPress and is used
// to detect if the current browser is internet explorer.
global $is_IE;
if ( $is_IE ) {
// If IE 11 or below, use a ponyfill to add CSS Variable support.
wp_register_script( 'css-vars-ponyfill', get_stylesheet_directory_uri() . '/assets/js/css-vars-ponyfill2.js', array(), wp_get_theme()->get( 'Version' ), true );
wp_enqueue_script( 'ie11-fix', get_template_directory_uri() . '/assets/js/ie11-fix.js', array( 'css-vars-ponyfill' ), wp_get_theme()->get( 'Version' ), true );
}
}
add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_scripts' );

Expand Down
Loading

0 comments on commit a50f356

Please sign in to comment.