From 24b0596c716d3cfa4a3474d43f3c099abaec9158 Mon Sep 17 00:00:00 2001 From: Tiago Noronha Date: Mon, 28 Aug 2017 22:15:22 +0100 Subject: [PATCH] Load WooCommerce Star fonts via inline styles. --- inc/woocommerce.php | 14 ++++++++++++++ sass/woocommerce.scss | 20 -------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/inc/woocommerce.php b/inc/woocommerce.php index 9413c51e..3f664bf8 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -30,6 +30,20 @@ add_action( 'after_setup_theme', '_s_woocommerce_setup' ); */ function _s_woocommerce_scripts() { wp_enqueue_style( '_s-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' ); + + $font_path = WC()->plugin_url() . '/assets/fonts/'; + $inline_font = '@font-face { + font-family: "star"; + src: url("' . $font_path . 'star.eot"); + src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"), + url("' . $font_path . 'star.woff") format("woff"), + url("' . $font_path . 'star.ttf") format("truetype"), + url("' . $font_path . 'star.svg#star") format("svg"); + font-weight: normal; + font-style: normal; + }'; + + wp_add_inline_style( '_s-woocommerce-style', $inline_font ); } add_action( 'wp_enqueue_scripts', '_s_woocommerce_scripts' ); diff --git a/sass/woocommerce.scss b/sass/woocommerce.scss index 6a67e2eb..4cf57490 100644 --- a/sass/woocommerce.scss +++ b/sass/woocommerce.scss @@ -4,12 +4,6 @@ Theme Name: _s WooCommerce styles override */ -/** - * WooCommerce Plugin path variables - */ -$woocommerce__plugin-path: '../../plugins/woocommerce/'; -$woocommerce__plugin-assets-font-path: '#{$woocommerce__plugin-path}assets/fonts/'; - /** * WooCommerce color variables */ @@ -23,20 +17,6 @@ $woocommerce__color-info: #3D9CD2; @import "variables-site/variables-site"; @import "mixins/mixins-master"; -/** - * Fonts - */ -@font-face { - font-family: 'star'; - src: url('#{$woocommerce__plugin-assets-font-path}star.eot'); - src: url('#{$woocommerce__plugin-assets-font-path}star.eot?#iefix') format('embedded-opentype'), - url('#{$woocommerce__plugin-assets-font-path}star.woff') format('woff'), - url('#{$woocommerce__plugin-assets-font-path}star.ttf') format('truetype'), - url('#{$woocommerce__plugin-assets-font-path}star.svg#star') format('svg'); - font-weight: normal; - font-style: normal; -} - /** * Shop tables */