Comments (22)
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.
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.
Gladly, there's a better way: basename( WP_CONTENT_DIR )
also gets the wp-content
folder name. Ha!
from wp-less.
LOLz! Good thinking to use basename. Nice one.
from wp-less.
closing?
from wp-less.
Not just yet, need to test and push it first. Got no time to do it during work hours at all!
from wp-less.
I already tested it and it works so far. Leaving open. Double testing always better.
from wp-less.
Didn't see this before I fixed the same issue in #8
from wp-less.
@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.
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.
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.
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.
Also worth noting that this also needs fixing in the code for parse_editor_stylesheets
/ url_to_handle
.
from wp-less.
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.
Cheers Rob.
from wp-less.
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.
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.
@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.
Why would you need to support a theme other than the active theme?
Parent/Child theme (just off of my head)
from wp-less.
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.
Haven't had time to test it so far, as I'll get to the project later today. Will report.
from wp-less.
Hadn't considered parent/child themes :/ Will test it out
from wp-less.
Related Issues (20)
- WP_LESS not working with add_editor_style HOT 7
- Add ability to refresh-compile via AJAX HOT 1
- parse_stylesheet - illegal offset HOT 2
- Wp-less wordpress plugin not compiling - wpengine sftp issue? HOT 3
- With SSL HOT 2
- WP Less Garbage Collection bloating DB HOT 3
- WP Less Garbage Collection bloating DB HOT 1
- Use WP-LESS in my plugin HOT 4
- Installation instructions vague for newbies. HOT 7
- CSS output to expanded/nested rather than 1 line? HOT 2
- wp-less-cache breaks relative URLs HOT 6
- Allow for plugins/themes to require wp-less via composer HOT 3
- lessphp is falling off, preparing for alternatives - how? HOT 19
- Switching to and from HTTP to HTTPS causes rebuilds HOT 2
- Package not in packagist HOT 4
- WP-LESS doesn't handle saving errors
- add LESS from string
- Less File Not Found/Handled in Plugin Using WP-Less
- PHP Warnings on WP Update Page
- Recompile wp less files with hook / action
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-less.