Code Monkey home page Code Monkey logo

Comments (4)

roborourke avatar roborourke commented on September 18, 2024

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.

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

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.

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

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.

roborourke avatar roborourke commented on September 18, 2024

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)

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.