Comments (4)
I think I made the decision to do it that way because you might want to output some less generated by php. I got the idea from the way ruby and rails allows you append file extensions and it runs the files through the processors in that order eg. style.css.scss.erb etc...
I think what's needed is to check the file outputs valid LESS.
What do you think to that approach? Can you think of any gotchas?
from wp-less.
Thinking loud
For the general test, I'd go with pathinfo()
-> ['extension']
. You could also do some explode( '.', $filename );
and check for the existance of .php
in the last index. Or leave what you currently got and just add the pathinfo check, that lets pass the .php
extension if .less.php
is also found (using strstr
).
from wp-less.
Here we go (not tested)...
$path_bits = pathinfo( $src ); if ( ! in_array( $path_bits['extension'], array( 'php', 'less' ) ) AND ! strstr( $src, '.less' ) ) return;
..but should work.
from wp-less.
Ok - had some time to work on this. I found the best approach to use a very explicit preg_match(). Unfortunately using pathinfo()
leaves the query string attached to the extension so it was simpler to do it the way it is now.
Thanks for bringing up these problems, as always very useful :)
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.