Sublime Text 3使用SublimeLinter配置JS,CSS,HTML语法检查
安裝Package Control
??Sublime安裝插件有兩種方式,一種是直接下載安裝包解壓縮到Packages目錄,另一種是通過Package Control組件來安裝組件,后者更加的方便。
打開Sublime,按control + ` 打開控制臺,粘貼如下代碼到命令行并回車;
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())重啟Sublime,在Perferences->Package Settings 中看到 Package Control,則表示安裝成功。
安裝SublimeLinter
??SublimeLinter是Sublime的一個代碼檢測工具插件。
安裝SublimeLinter前必須安裝node.js
打開Sublime,按下 Ctrl+Shift+p 進入 Command Palette;
輸入install進入 Package Control: Install Package;
輸入SublimeLinter,選擇SublimeLinter進行安裝。
安裝sublimeLinter-contrib-htmlhint
??可以把sublimeLinter-contrib-htmlhint看成是SublimeLinter的一個插件,sublimeLinter-contrib-htmlhint調用xg-htmlhint來進行語法檢查。sublimeLinter-contrib-htmlhint 1.0.1版本有問題,所以我們使用1.0.0版本。
前往Releases下載1.0.0的壓縮包,解壓并重命名為“SublimeLinter-contrib-htmlhint”,并放入Sublime的Package目錄(菜單->Preferences->Browse
Packages)
安裝xg-htmlhint
找到node.js的CMD窗口,輸入以下命令;等待出現一堆數字版本號即為成功安裝。
npm install -g xg-htmlhint??此時打開Sublime Text3,xg-htmlhint就可以檢測代碼了,保存(cmd + S)的時候如果有錯誤會有錯誤提示。
安裝jshint和csslint
打開Sublime_Txt3,按住Ctrl+Shift+P安裝
Sublime?Linter-csslint Sublime?Linter-jshint打開nodejs的CDM窗口,輸入命令安裝
npm install jshint npm install csslintSublimeLinter個性化配置
{"user": {"csslint_options": {"adjoining-classes": false,"box-model": false,"box-sizing": false,"compatible-vendor-prefixes": false,"floats": false,"font-sizes": false,"gradients": false,"important": false,"known-properties": false,"outline-none": false,"qualified-headings": false,"regex-selectors": false,"shorthand": false,"text-indent": false,"unique-headings": false,"universal-selector": false,"unqualified-attributes": false},"debug": false,"delay": 0.25,"error_color": "D02000","gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme","gutter_theme_excludes": [],"jshint_options": {"browser": true,"curly": true,"devel": true,"eqeqeq": true,"evil": true,"forin": true,"globals": {"$": true,"console": true,"document": true,"global": true,"grunt": true,"jQuery": true,"module": true,"setInterval": true,"setTimeout": true,"window": true},"jquery": true,"latedef": true,"noarg": true,"noempty": true,"quotmark": "single","strict": false,"undef": true,"unused": "vars","wsh": true},"lint_mode": "background","linters": {"csslint": {"@disable": false,"args": [],"errors": "","excludes": [],"ignore": "","warnings": ""},"htmlhint": {"@disable": false,"args": [],"excludes": []},"jshint": {"@disable": false,"args": [],"excludes": []}},"mark_style": "outline","no_column_highlights_line": false,"passive_warnings": false,"paths": {"linux": [],"osx": [],"windows": []},"python_paths": {"linux": [],"osx": [],"windows": []},"rc_search_limit": 3,"shell_timeout": 10,"show_errors_on_save": false,"show_marks_in_minimap": true,"sublimelinter": "save-only","sublimelinter_executable_map": {"css": "C:/Program Files/nodejs/node.exe","javascript": "C:/Program Files/nodejs/node.exe"},"sublimelinter_gutter_marks": true,"sublimelinter_popup_errors_on_save": true,"syntax_map": {"html (django)": "html","html (rails)": "html","html 5": "html","javascript (babel)": "javascript","magicpython": "python","php": "html","python django": "python"},"warning_color": "DDB700","wrap_find": true} }總結
以上是生活随笔為你收集整理的Sublime Text 3使用SublimeLinter配置JS,CSS,HTML语法检查的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 作业调度与系统日志
- 下一篇: HTML5 Canvas游戏开发(一)基