[Plugin: WordPress Twitter Bootstrap CSS] Compile Responsive Less as well
-
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]
I use the responsive less, and some of the changes I make both in the dashboard and directly in the variables.less file (see my other post for issues there) require the responsive less to be re-compiled.
This is a fairly easy addition and I have hacked my local copy to get it done, but of course it’d be best to include it in the main plug-in code so I can take advantage of updates.
Here’s what I added:
//////////CODE///////// public function compileResponsiveLess( $insBootstrapDir ) { $sFilePathBootstrapLess = $insBootstrapDir.'less'.DS.'responsive.less'; //parse LESS include_once( dirname(__FILE__).'/inc/lessc/lessc.inc.php' ); $oLessCompiler = new lessc( $sFilePathBootstrapLess ); $sCompiledCss = ''; try { $sCompiledCss = $oLessCompiler->parse(); $sLessFile = $insBootstrapDir.'css'.DS.'bootstrap-responsive'; file_put_contents( $sLessFile.'.css', $sCompiledCss ); //Basic Minify $sCompiledCss = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $sCompiledCss); file_put_contents( $sLessFile.'.min.css', $sCompiledCss ); } catch ( Exception $oE ) { echo "lessphp fatal error: ".$oE->getMessage(); } }//compileLess //////////END CODE///////// And then at the end of the functions "processNewLessOptions" and "resetToDefaultAllLessOptions", I added the line: $this->compileResponsiveLess($insBootstrapDir);
I’d love to see this added in the future version!
Thanks again for a great plugin.
https://www.ads-software.com/extend/plugins/wordpress-bootstrap-css/
- The topic ‘[Plugin: WordPress Twitter Bootstrap CSS] Compile Responsive Less as well’ is closed to new replies.