Code Monkey home page Code Monkey logo

Comments (22)

roborourke avatar roborourke commented on September 18, 2024

Thanks for looking into this and providing a fix dude. I'm struggling to find some of the stuff you mentioned though, where in the WP core is WP_CONTENT_FOLDERNAME referenced?

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

Damn me. That's my custom constant *facepalm*... Here's the bill for adding the "wp" prefix... mpf. I'll have to rethink this one...

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

Gladly, there's a better way: basename( WP_CONTENT_DIR ) also gets the wp-content folder name. Ha!

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

LOLz! Good thinking to use basename. Nice one.

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

closing?

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

Not just yet, need to test and push it first. Got no time to do it during work hours at all!

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

I already tested it and it works so far. Leaving open. Double testing always better.

from wp-less.

willmot avatar willmot commented on September 18, 2024

Didn't see this before I fixed the same issue in #8

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

@willmot get_template_directory(); will only work for the currently active theme.

@sanchothefat This is the exact change (don't want to make a fork for this single stuff): LINE 42-51

// we only want to handle .less files
if ( ! strstr( $src, '.less' ) )
    return $src;

// get file path from $src
preg_match( "/^(.*?\/" . basename( WP_CONTENT_DIR ) . "\/)([^\?]+)(.*)$/", $src, $src_bits );
$less_path = WP_CONTENT_DIR . '/' . $src_bits[ 2 ];

// output css file name
$css_path = $this->get_cache_dir() . "/$handle.css";

from wp-less.

willmot avatar willmot commented on September 18, 2024

Why would you need to support a theme other than the active theme?

basename( WP_CONTENT_DIR ) doesn't work if WP_CONTENT_DIR is set to root (which it is in our setup).

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

Maybe I should just put in a define() that you can override before wp-less.php is included. I'm not sure I could make something that would work for the default setup and for your crazy setups :P

Tom, can you tell me what you set WP_CONTENT_DIR to exactly is it just '/' or an empty string?

from wp-less.

willmot avatar willmot commented on September 18, 2024

Hey Rob,

We set WP_CONTENT_DIR in wp-config.php as the following:

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) );

Our "crazy setup" is the one evangelised by Mark Jaqueth & Nacin as it allows you to submodule WordPress in rather than having to include all the WordPress files in your repo directly.

I pushed another change to #8 that fixes the issue with less files in plugins or non-active themes, cc @franz-josef-kaiser

from wp-less.

willmot avatar willmot commented on September 18, 2024

Also worth noting that this also needs fixing in the code for parse_editor_stylesheets / url_to_handle.

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

Guys - thank you both for the feedback and contribution. I've pulled in Tom's changes as it handles that extra edge case of the git based setup.

Sorry it took me so long to get this in officially.

from wp-less.

willmot avatar willmot commented on September 18, 2024

Cheers Rob.

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

Sorry - one addition, I meant to say my comment re. a "crazy setup" wasn't a dig or anything, it's just something I haven't played with as I've never used wordpress in a git based workflow. Honestly I'm kinda ignorant of the reasons for moving away from the defaults but anyway - this seems to work now :)

from wp-less.

willmot avatar willmot commented on September 18, 2024

He Rob, totally cool.

Was my fault as my reply came off like I was being defensive about the "crazy setup", didn't intend it to be at all. It is a crazy setup :-), none of our plugins worked with it either.

Great plugin, we're using it on the new human made site. http://hmn.md

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

@sanchothefat @willmot As I ran into the issue more than once, I now have my default local dev setup with all sorts of custom stuff applied. Imho public plugins need to get around this stuff... but I'm still learning every day. :)

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

@willmot

Why would you need to support a theme other than the active theme?

Parent/Child theme (just off of my head)

from wp-less.

willmot avatar willmot commented on September 18, 2024

Yeah I realised that (also plugins) after I posted my comment, I updated my pull request before @sanchothefat merged it to account for stylesheets in other themes / plugins. Is it working for you?

from wp-less.

franz-josef-kaiser avatar franz-josef-kaiser commented on September 18, 2024

Haven't had time to test it so far, as I'll get to the project later today. Will report.

from wp-less.

roborourke avatar roborourke commented on September 18, 2024

Hadn't considered parent/child themes :/ Will test it out

from wp-less.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.