NodeJS Sublime environment configuration

Please indicate the source for the original reprint: http://agilestyle.iteye.com/blog/2352335

 

Prerequisite


 


 

 

https://github.com/tanepiper/SublimeText-Nodejs download zip package


 

After decompression, rename to nodejs, copy to

C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages


 

Set the build environment to nodejs

Tools > Build System > Nodejs


 

 

Configuration Environment

Preferences > Package Settings > Nodejs > Settings-Default 


Modify as follows: 

{
  // save before running commands
  "save_first": true,
  // if present, use this command instead of plain "node"
  // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  "node_command": "C:/Program Files/nodejs/node.exe",
  // Same for NPM command
  "npm_command": "C:/Program Files/nodejs/npm.cmd",
  // as 'NODE_PATH' environment variable for node runtime
  "node_path": "C:/Users/Administrator/AppData/Roaming/npm/node_modules",

  "expert_mode": true,

  "ouput_to_new_tab": false
}

 

Create a new index.js file and write a NodeJS script

var http = require('http');

http.createServer(function (request, response) {
	response.writeHead(200, {'Content-Type': 'text/plain'});

	response.end('Hello World\n');
}).listen(8888);

console.log('Server running at http://127.0.0.1:8888/');

 

Ctrl + B to run


 

After running successfully, if you want to stop the service, you can stop the service in Tools > Cancel Build


 

Sublime installs several well-known plugins as a JS IDE

JsFormat

https://github.com/jdc0589/JsFormat

Usage

Either cmd+alt+f on OS X or ctrl+alt+f on Linux/Windows

 

JSHint

https://github.com/uipoet/sublime-jshint

Usage

ctrl+j on OS X or alt+j on Linux/Windows

 

JavaScriptNext

https://github.com/Benvie/JavaScriptNext.tmLanguage

Usage

You can either set individual JavaScript files to use this syntax highlighter by changing it in the “View -> Syntax” menu or you can change it for all JavaScript files in the “View -> Syntax -> Open all with current extension as...”.

 

sublime-marko

https://github.com/merwan7/sublime-marko 

 

HTMLPrettify

https://github.com/victorporof/Sublime-HTMLPrettify

 

emmet-sublime

https://github.com/sergeche/emmet-sublime

note:这个插件安装需要安装PyV8(https://github.com/emmetio/pyv8-binaries

emmet初始化html,输入 html:5 ,之后按下 Ctrl + E

 

另外可以修改Sublime默认的 编码、字体大小、Tab

Preferences > Settings - User

{
	"default_encoding": "UTF-8",
	"font_size": 16,
	"tab_size": 2
}

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326992718&siteId=291194637
Recommended