Visual Studio 2012 - Pre-Build Bootstrap 3 LESS with RECESS
Warning: This no longer works as of Bootstrap version 3.1!
Step 1:
Install the Bootstrap Less Source package to your web project.
Step 2:
Close any running instances of Visual Studio.
Step 3:
Install Node.js.
Step 4:
Install the RECESS npm package globally via the node.js command prompt:
$ npm install recess -g
Step 5:
Start Visual Studio.
Step 6:
Re-open your web project, open the Project properties, go to Build Events, and enter in the following into the "Pre-build event command line:"
recess "$(ProjectDir)Content\bootstrap\bootstrap.less" --compress > "$(ProjectDir)Content\bootstrap-compiled.css"
Note: The double quotes around the files was required for the command to succeed.
Step 7:
Build your project, and check to see if the bootstrap-compiled.css
file was created properly.
Step 8:
Make sure you include the bootstrap-compiled.css
file into your project, and set its Build Action to Content.
Step 9:
Set the Build Action on the bootstrap less files to None.
Edit: I've updated the steps to include opening and closing Visual Studio. This is done to make sure that Visual Studio will see the updated %PATH%
environment variable from the node.js installation.