安装sublime3 Package Control
- 按下 ctrl+`
- 复制粘贴以下代码:1import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
安装sublime3插件
- 按下 ctrl+shift+p,输入’ip’(Install Package)
- 输入以下插件的名字,按顺序逐个进行安装:
- Emmet (编码快捷键,前端必备)
- Alignment(”=”号对齐)
- autoprefixer (CSS添加私有前缀)
- EditorConfig
- LESS(LESS高亮插件)
- jQuery (jquery 语法提示)
- Sass (Sass高亮插件)
- SublimeLinter ()
- SublimeLinter-jscs (js代码风格检查工具)
- SublimeLinter-jshint (js 代码检查)
- SublimeLinter-csslint (css 代码检查)
- SublimeLinter-contrib-scss-lint (sass 代码检查)
- JSFormat (JavaScript的代码格式化插件)
- CSScomb (css的代码格式化插件)
安装node包
jscs
1npm install -g jscsjshint
1npm install -g jshintcsscomb
1npm install -g csscombcsslint
1npm install -g csslint
编辑器及插件设置
sublime3 自身
Preferences->Setting-User,增加下面两个配置:1234{"translate_tabs_to_spaces": true,"word_wrap": true}JSFormat
Preferences->Package Settings->JSFormat->Setting-User:12345678910111213141516171819202122{"indent_size": 4,"indent_char": " ","eol": "\n","indent_level": 0,"indent_with_tabs": false,"preserve_newlines": true,"max_preserve_newlines": 10,"jslint_happy": false,"space_after_anon_function": false,"brace_style": "collapse","keep_array_indentation": false,"keep_function_indentation": false,"space_before_conditional": true,"break_chained_methods": false,"eval_code": false,"unescape_strings": false,"wrap_line_length": 0,"wrap_attributes": "auto","wrap_attributes_indent_size": 4,"end_with_newline": true}配置好后格式化的默认快捷键是 ctrl+alt+f
CSScomb
Preferences->Package Settings->CSScomb->Setting-User:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333{"config": {"remove-empty-rulesets": true,"always-semicolon": true,"color-case": "lower","block-indent": " ","color-shorthand": true,"element-case": "lower","eof-newline": true,"leading-zero": false,"quotes": "double","sort-order-fallback": "abc","space-before-colon": "","space-after-colon": " ","space-before-combinator": " ","space-after-combinator": " ","space-between-declarations": "\n","space-before-opening-brace": " ","space-after-opening-brace": "\n","space-after-selector-delimiter": "\n","space-before-selector-delimiter": "","space-before-closing-brace": "\n","strip-spaces": true,"tab-size": true,"unitless-zero": true,"vendor-prefix-align": true,"sort-order": [["display","visibility","float","clear","overflow","overflow-x","overflow-y","clip","zoom"],["table-layout","empty-cells","caption-side","border-spacing","border-collapse","list-style","list-style-position","list-style-type","list-style-image"],["-webkit-box-orient","-webkit-box-direction","-webkit-box-decoration-break","-webkit-box-pack","-webkit-box-align","-webkit-box-flex"],["position","top","right","bottom","left","z-index"],["margin","margin-top","margin-right","margin-bottom","margin-left","-webkit-box-sizing","-moz-box-sizing","box-sizing","border","border-width","border-style","border-color","border-top","border-top-width","border-top-style","border-top-color","border-right","border-right-width","border-right-style","border-right-color","border-bottom","border-bottom-width","border-bottom-style","border-bottom-color","border-left","border-left-width","border-left-style","border-left-color","-webkit-border-radius","-moz-border-radius","border-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-image","-moz-border-image","-o-border-image","border-image","-webkit-border-image-source","-moz-border-image-source","-o-border-image-source","border-image-source","-webkit-border-image-slice","-moz-border-image-slice","-o-border-image-slice","border-image-slice","-webkit-border-image-width","-moz-border-image-width","-o-border-image-width","border-image-width","-webkit-border-image-outset","-moz-border-image-outset","-o-border-image-outset","border-image-outset","-webkit-border-image-repeat","-moz-border-image-repeat","-o-border-image-repeat","border-image-repeat","padding","padding-top","padding-right","padding-bottom","padding-left","width","min-width","max-width","height","min-height","max-height"],["font","font-family","font-size","font-weight","font-style","font-variant","font-size-adjust","font-stretch","font-effect","font-emphasize","font-emphasize-position","font-emphasize-style","font-smooth","line-height","text-align","-webkit-text-align-last","-moz-text-align-last","-ms-text-align-last","text-align-last","vertical-align","white-space","text-decoration","text-emphasis","text-emphasis-color","text-emphasis-style","text-emphasis-position","text-indent","-ms-text-justify","text-justify","letter-spacing","word-spacing","-ms-writing-mode","text-outline","text-transform","text-wrap","-ms-text-overflow","text-overflow","text-overflow-ellipsis","text-overflow-mode","-ms-word-wrap","word-wrap","-ms-word-break","word-break"],["color","background","filter:progid:DXImageTransform.Microsoft.AlphaImageLoader","background-color","background-image","background-repeat","background-attachment","background-position","-ms-background-position-x","background-position-x","-ms-background-position-y","background-position-y","-webkit-background-clip","-moz-background-clip","background-clip","background-origin","-webkit-background-size","-moz-background-size","-o-background-size","background-size"],["outline","outline-width","outline-style","outline-color","outline-offset","opacity","filter:progid:DXImageTransform.Microsoft.Alpha(Opacity","-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha","-ms-interpolation-mode","-webkit-box-shadow","-moz-box-shadow","box-shadow","filter:progid:DXImageTransform.Microsoft.gradient","-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient","text-shadow"],["-webkit-transition","-moz-transition","-ms-transition","-o-transition","transition","-webkit-transition-delay","-moz-transition-delay","-ms-transition-delay","-o-transition-delay","transition-delay","-webkit-transition-timing-function","-moz-transition-timing-function","-ms-transition-timing-function","-o-transition-timing-function","transition-timing-function","-webkit-transition-duration","-moz-transition-duration","-ms-transition-duration","-o-transition-duration","transition-duration","-webkit-transition-property","-moz-transition-property","-ms-transition-property","-o-transition-property","transition-property","-webkit-transform","-moz-transform","-ms-transform","-o-transform","transform","-webkit-transform-origin","-moz-transform-origin","-ms-transform-origin","-o-transform-origin","transform-origin","-webkit-animation","-moz-animation","-ms-animation","-o-animation","animation","-webkit-animation-name","-moz-animation-name","-ms-animation-name","-o-animation-name","animation-name","-webkit-animation-duration","-moz-animation-duration","-ms-animation-duration","-o-animation-duration","animation-duration","-webkit-animation-play-state","-moz-animation-play-state","-ms-animation-play-state","-o-animation-play-state","animation-play-state","-webkit-animation-timing-function","-moz-animation-timing-function","-ms-animation-timing-function","-o-animation-timing-function","animation-timing-function","-webkit-animation-delay","-moz-animation-delay","-ms-animation-delay","-o-animation-delay","animation-delay","-webkit-animation-iteration-count","-moz-animation-iteration-count","-ms-animation-iteration-count","-o-animation-iteration-count","animation-iteration-count","-webkit-animation-direction","-moz-animation-direction","-ms-animation-direction","-o-animation-direction","animation-direction"],["content","quotes","counter-reset","counter-increment","resize","cursor","-webkit-user-select","-moz-user-select","-ms-user-select","user-select","nav-index","nav-up","nav-right","nav-down","nav-left","-moz-tab-size","-o-tab-size","tab-size","-webkit-hyphens","-moz-hyphens","hyphens","pointer-events"]]}}配置好后格式化的默认快捷键是 ctrl+shift+c
SublimeLinter
右键->SublimeLinter->Lint Mode,有4种检查模式,建议选择 Load/save
右键->SublimeLinter->Mark Style,建议选择 Outline
右键->SublimeLinter->Choose Gutter Theme,建议选择 Blueberry-round
右键->SublimeLinter->Open User Settings,将linter里面jscs的args改成 [“–verbose”],将linter里面csslint的ignore改成 [
“box-model,adjoining-classes,box-sizing,compatible-vendor-prefixes,gradients,text-indent,fallback-colors,star-property-hack,underscore-property-hack,bulletproof-font-face,order-alphabetical,font-faces,import,regex-selectors,universal-selector,unqualified-attributes,overqualified-elements,duplicate-background-images,floats,font-sizes,ids,important,outline-none,qualified-headings,unique-headings”]当光标处于有错误的代码行时,详细的错误信息会显示在下面的状态栏中