Title: [Plugin: WordPress Twitter Bootstrap CSS] Compile Responsive Less as well
Last modified: August 20, 2016

---

# [Plugin: WordPress Twitter Bootstrap CSS] Compile Responsive Less as well

 *  Resolved [deremer](https://wordpress.org/support/users/deremer/)
 * (@deremer)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/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.
 * [http://wordpress.org/extend/plugins/wordpress-bootstrap-css/](http://wordpress.org/extend/plugins/wordpress-bootstrap-css/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872881)
 * Thanks again for the idea and of course the code contribution!
 * I’ll look at adding this in for version 2.1.0 when Bootstrap itself is updated.
 * Will keep you posted!
    Cheers, Paul.
 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872882)
 * Hey,
 * Another update 😉
 * The code necessary for recompiling Responsive css is now in the TRUNK. I haven’t
   released this and wont probably until v2.1.0
 * If you want it now, you can download the trunk zip file and replace your plugin
   with it.
 * Let me know how you get on with it 🙂
    Cheers, Paul.
 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872905)
 * Decided to release v2.0.4.6 of the plugin and it contain this change.
 * Let me know how it works for you.
    Cheers, Paul.
 *  Thread Starter [deremer](https://wordpress.org/support/users/deremer/)
 * (@deremer)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872916)
 * BTW, this works great. Thank you!!
 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872919)
 * Delighted to hear it!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: WordPress Twitter Bootstrap CSS] Compile Responsive Less as 
well’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-bootstrap-css_d0f2fd.svg)
 * [Twitter Bootstrap for WordPress](https://wordpress.org/plugins/wordpress-bootstrap-css/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-bootstrap-css/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-bootstrap-css/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-bootstrap-css/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-bootstrap-css/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-bootstrap-css/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-twitter-bootstrap-css-compile-responsive-less-as-well/#post-2872919)
 * Status: resolved