1.安裝node.js
2.安裝csslint,jshint
找到node.js comand prompt,輸入如下命令javascript
npm install csslint
npm install jshintphp
這兩個就是實際起做用的組件。css
ctrl+shift+p打開sublime Text 包管理面板輸入pci選擇package control installhtml
輸入sublimelinter,選擇安裝。(不建議將包直接丟進package裏,麻煩實在太多)java
重複1,2步輸入sublimelinter-csslint,安裝。node
重複1,2步輸入sublimelinter-jshint,安裝。python
1.修改校驗器的路徑。jquery
"sublimelinter_executable_map":
"javascript":"d:/program file/nodejs/node.exe",
"css":"d:/program file/nodejs/node.exe"linux
2.對校驗選項選項進行修改,特別是css。下方爲網上經常使用的設置。shell
{ "user": { "csslint_options": { "adjoining-classes": false, "box-model": false, "box-sizing": false, "compatible-vendor-prefixes": false, "duplicate-background-imges": false, "floats": false, "font-sizes": false, "gradients": false, "ids": 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": "save only", "linters": { "csslint": { "@disable": false, "args": [], "errors": "", "excludes": [], "ignore": "", "warnings": "" }, "htmlhint": { "@disable": true, "args": [], "excludes": [] }, "jshint": { "@disable": true, "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 (x86)/nodejs/node.exe", "html": "C:/Program Files (x86)/nodejs/node.exe", "javascript": "C:/Program Files(x86)/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 } }
3.這個時候可能會發現對csslint單獨設置的options並無起到做用,雖然sulimelinter的官方文檔也說了是有效的。不過可使用ignore對warings進行忽略。
"csslint": { "@disable": false, "args": [], "errors": "", "excludes": [], "ignore": [ "ids", "box-model", "box-sizing", "universal-selector", "duplicate-background-imges", "adjoining-classes", "text-indent" ], "warnings": "" },