Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions class/class-wp-scss.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,20 @@ public function style_url_enqueued($url){
* so it can be used in a url, not path
*/
public function enqueue_files($base_folder_path, $css_folder) {
// We use realpath() to normalize any forward, backward, or trailing slack inconsistencies.
$relative_path = explode(realpath(get_home_path()), realpath($base_folder_path))[1];

// In case we're on a Windows machine
$relative_path = str_replace('\\', '/', $relative_path);

$enqueue_base_url = get_home_url() . '/' . $relative_path;

$relative_path = explode(get_home_path(), $base_folder_path)[1];
foreach( new DirectoryIterator($this->css_dir) as $stylesheet ) {
if ( pathinfo($stylesheet->getFilename(), PATHINFO_EXTENSION) == 'css' ) {
$name = $stylesheet->getBasename('.css') . '-style';
$uri = '/'.$relative_path.$css_folder.$stylesheet->getFilename();
$uri = $enqueue_base_url . $css_folder . $stylesheet->getFilename();
$ver = $stylesheet->getMTime();


wp_register_style(
$name,
$uri,
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Alternatively, you can include [Bourbon](https://github.com/thoughtbot/bourbon)
This plugin will only work with .scss format.

## Changelog
* 2.1.5
* Enqueue CSS files using `realpath` function. Addition by [mmcev106](https://github.com/ConnectThink/WP-SCSS/pull/179)
* 2.1.4
* Set source URL to be home_url('/') not simply `/`. Issue found by [realjjaveweb](https://github.com/ConnectThink/WP-SCSS/issues/128)
* 2.1.3
Expand Down
4 changes: 2 additions & 2 deletions wp-scss.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP-SCSS
* Plugin URI: https://github.com/ConnectThink/WP-SCSS
* Description: Compiles scss files live on WordPress.
* Version: 2.1.4
* Version: 2.1.5
* Author: Connect Think
* Author URI: http://connectthink.com
* License: GPLv3
Expand Down Expand Up @@ -44,7 +44,7 @@
define('WPSCSS_VERSION_KEY', 'wpscss_version');

if (!defined('WPSCSS_VERSION_NUM'))
define('WPSCSS_VERSION_NUM', '2.1.4');
define('WPSCSS_VERSION_NUM', '2.1.5');

// Add version to options table
if ( get_option( WPSCSS_VERSION_KEY ) !== false ) {
Expand Down