JavaScript console debugging and output in the browser side of the use of the work is commonly used, as the front-end development of the main editor sublime text itself is not support JavaScript output and run. Sometimes we need to look at the effect of the output and have to use the F12 to view the console program. As a plug-in system and its rich editor, we can add the build system method to let sublime text support JavaScript console console debugging.
JSC Mode (Mac OS X)
The 1.MAC includes a JavaScript console program with deep paths:
/system/library/frameworks/javascriptcore.framework/versions/a/resources/jsc
:
2. Start Sublime text,tools > Build System > New build System as shown in:
3. Configure the option contents, save in the default User directory:
{
"cmd": ["/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc", "$file"],
"selector": "source.js"
}
:
4. Create a new JS file test console output, it is important to note that the use of debug, but not the use of Console.log, so we recommend the use of the second way to use Nodejs;
Nodejs Way
1. Download the installation Nodejs, if for Nodejs installation unfamiliar can refer to my previous blog;
2. In the second step of repeating JSC mode, add the following to build Sytem:
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
Most of the online introduction is like this, some can be successful, but I am not fortunate that part, cannot succeed, if you have not succeeded can refer to the following ways, terminal run:
which node
Get the path as follows:
/users/keso/.nvm/versions/node/v0.12.7/bin/node
Reconfigure the following:
{
"cmd": ["/Users/keso/.nvm/versions/node/v0.12.7/bin/node", "$file"],
"selector": "source.js"
}
3. Test the output effect:
In both of these two ways can alleviate a part of the development work, recommend the second way ~
Sublime Text 3 running the JavaScript console