发布于 2016-01-04 03:44:15 | 370 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的Sublime Text教程,程序狗速度看过来!

Sublime Text 代码编辑器

Sublime Text 是一个代码编辑器(Sublime Text 2是收费软件,但可以无限期试用),也是HTML和散文先进的文本编辑器。Sublime Text是由程序员Jon Skinner于2008年1月份所开发出来,它最初被设计为一个具有丰富扩展功能的Vim。


准备工作


1.安装node.js
2.安装csslint,jshint
   找到node.js comand prompt,输入以下命令

npm install csslint
npm install jshint

这两个就是实际起作用的组件。

安装sublimelinter


  • ctrl+shift+p打开sublime Text 包管理面板输入pci选择package control install

  • 输入sublimelinter,选择安装。(不建议将包直接丢进package里,麻烦实在太多)

  • 重复1,2步输入sublimelinter-csslint,安装。

  • 重复1,2步输入sublimelinter-jshint,安装。

进行设置


1.修改校验器的路径。

"sublimelinter_executable_map":
"javascript":"d:/program file/nodejs/node.exe",
"css":"d:/program file/nodejs/node.exe"

2.对校验选项选项进行修改,特别是css。下方为网上常用的设置。

{
    "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": ""
            },
            


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务