wp-scss – changing path variables to compile in a plugin folder instead *WORDPRESS

Just installed wp-scss plugin, however I would like the scss to compile to a plugin folder instead

$wpscss_settings = array(
  'scss_dir'  =>  WPSCSS_THEME_DIR . $scss_dir_setting,
  'css_dir'   =>  WPSCSS_THEME_DIR . $css_dir_setting,
  'compiling' =>  $wpscss_options['compiling_options'],
  'errors'    =>  $wpscss_options['errors'],
  'enqueue'   =>  isset($wpscss_options['enqueue']) ? $wpscss_options['enqueue'] : 0
);

what should I change the WPSCSS_THEME_DIR to be..

Read More
$plugin_url = plugin_url();
$wpscss_settings = array(
  'scss_dir'  =>  $plugin_url . $scss_dir_setting,
  'css_dir'   =>  $plugin_url . $css_dir_setting,
  'compiling' =>  $wpscss_options['compiling_options'],
  'errors'    =>  $wpscss_options['errors'],
  'enqueue'   =>  isset($wpscss_options['enqueue']) ? $wpscss_options['enqueue'] : 0
);

I know that I need to have the right privileges but is this advised as the latter version white screened and had to revert?

Related posts

1 comment

  1. I had to do a similar thing, so I had to edit the plugin global variables. Please be advised, if this plugin ever gets updated, you will lose any code you change here.

    In wp-scss.php file, find the first global variable around line 31. Change your path from “get_stylesheet_directory()” to wherever you want the root of where this plugin looks for scss files. Then in the plugin settings in the backend of WP, you can edit the specific subfolder.

    Original Plugin Code:

    // Plugin Paths
    if (!defined('WPSCSS_THEME_DIR'))
        define('WPSCSS_THEME_DIR', get_stylesheet_directory());
    

    Your Edited Plugin Code:

    // Plugin Paths
    if (!defined('WPSCSS_THEME_DIR'))
        define('WPSCSS_THEME_DIR', my_custom_stylesheet_dir());
    

    In functions.php, you could then write something like this:

    function my_custom_stylesheet_dir() {
    
       return '/path/to/my/directory';
    
    }
    

Comments are closed.