Sublime Text Plugins — Web Fundamentals

The minute you start developing a site, the first tool you’ll use is a text editor, whether it’s as simple as notepad or a full blown IDE.

In this episode Addy & Matt look at their collection of plugins for Sublime Text and discuss how each one helps with their workflow.

Package Control

To get the packages (or plugins) referenced in the episode, you need to install Package Control, it’s nice and simple to install and you can find instructions on how to do so here.

JSHint

JSHint is a JavaScript linter which examines your JavaScript and highlights any possible errors or bad practices in your code.

For exmample, if you accidentally typed a variable name wrong, like below, then JSHint will point out that fo was never defined and is going to cause an error.

var foo = { bar: ‘Hello, World.‘ };
var msg = fo.bar;

The JSHint plugin points out issues the by displaying a yellow box around the relevant text and placing your cursor in that bit of code will result in an error message being shown in the bottom left of Sublime.

Other issues it’ll catch are:

  • Variables which are defined but never used
  • Avoiding creating functions inside of loops
  • Using the right comparison methods

To install the SublimeLinter-JSHint Package you’ll need to also install the SublimeLinterpackage and follow the installation instructions on the SublimeLinter-JSHint Package page.

Some developers may find it helpful to include the JSHint Gutter plugin as well. It places a small dot in the gutter of any line with a JSHint issue.

JSCS

JSCS will highlight any places where your JavaScript isn’t following a specific coding style.

For example, JSCS can be used to define whether spaces should be used after keywords, like ‘if’, or defining whether curly braces should be on the same line or new line of a method.

The SublimeLinter-JSCS package highlights any issues inline in a similar style to JSHint making it easy to correct any problems.

This is extremely helpful when it comes to working in a team as everyone can follow the same styleguide and keep your code consistent.

The best bit is, with the JSCS-Formatter package you can automatically fix any issues on the page by pressing ctrl + shift + p, typing ‘JSCS Formatter: Format this file’ and pressing enter. You learn more in Addy’s blog post.

Color Highlighter

Color highlighter will add a color to the background of any color definitions in your CSS or Sass.

You can define whether it shows as an underline with a full background when you hover over it or always displays color on the definition background. Just go to ‘Package Settings’ > ‘Color Highlighter’ > ‘Settings - Default’ to see the initial settings and alter your settings in ‘Settings - User’.

For full background highlighting add the following to the ‘Settings - User’ file:

{
  "ha_style": "filled"
}

Gutter Color

Gutter Color is an alternative to color highlighter, instead of showing the color on top of the color variable, it puts the color in the gutter of that line.

Color Picker

If you ever need a quick and easy way to select a color from your screen then the Color Picker Package may be for you.

Press ctrl + shift + c and boom - you got yourself a color picker.

AutoFileName

AutoFileName is a simple little plugin which gives you a list of possible files as you type. This is super handy if you’re trying to type out an image name or add a CSS or JS file as it saves you time and more importantly reduces the risk of typos.

Autoprefixer

We’ve all had that moment of realisation where we’ve forgotten to add a prefixed CSS property. With Autoprefixer you simple run it on your CSS and it’ll add all the prefixes you need.

It means we go from this..

.container-thingy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

..to the following, just by hitting ctrl + shift + p and typing ‘Autoprefix CSS’ and hitting enter.

.container-thingy {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
  -webkit-align-items: flex-start;
      -ms-flex-align: start;
          align-items: flex-start;
}

You can also define what browsers and browser versions you would like to support in the package settings. Checkout the Package Control page for more info.

More…

There are a tonne of other plugins that exist for Sublime Text, so be sure to explorePackage Control.

For more advice and tips, you should checkout WesBos’s great slide deck on keyboard shortcuts and other plugins for Sublime Text.

WesBos has also written a book titled ‘Sublime Text for the Power User’ which may be of interest to you wonderful people as well :)

时间: 2024-10-05 11:10:21

Sublime Text Plugins — Web Fundamentals的相关文章

【转】3 Essential Sublime Text Plugins for Node & JavaScript Developers

原文转自:http://scottksmith.com/blog/2014/09/29/3-essential-sublime-text-plugins-for-node-and-javascript-developers/ Check out these 3 great and essential Sublime Text plugins every JavaScript and Node developer should know about and use. JsFormat https:

Essential Sublime Text Plugins

Essential Sublime Text Plugins Add some killer tools to your arsenal. View them all at /repo/sublimeText HTML / CSS SCSS Snippets Emmet CanIUse Handlebars 28+ more at /repo/sublimeText JavaScript JavaScript Snippets Pretty JSON NodeJS 17+ more at /re

sublime text plugins

Sublime Text 插件,HTML+CSS+JAVASCRIPT+JSON快速格式化:  htmlpretty 快捷键:Ctrl+Shift+H Essential Sublime Text 2 Plugins and Extensionshttp://code.tutsplus.com/tutorials/essential-sublime-text-2-plugins-and-extensions–net-24173 Sublime Text 使用介绍.全套快捷键及插件推荐http:/

Sublime Text 3 web 开发常用配置

前沿 Sublime Text 是一个代码编辑器(Sublime Text 2是收费软件,但可以无限期试用),也是HTML和散文先进的文本编辑器.Sublime Text是由程序员Jon Skinner于2008年1月份所开发出来,它最初被设计为一个具有丰富扩展功能的Vim.是目前应用最广泛的编程工具之一,受到众多程序猿的追捧.网络上已有很多关于Sublime Text3的配置文章,但很多都不太适合本人的需求,很多插件在前端开发中很少会用到或者不能恰当的使用.由于每次重装一次Sublime Te

学习web前端之神器sublime text 3

第一次在博客园写博客,以前都是看别人写的技术在自己慢慢的学习.现在想自己把每天学习的东西理解并记录下来,加深下印象以后可以做个回顾.不知道自己能否坚持每周至少写2篇博文. 古话说的好:工欲善其事,必先利其器.所以我们要找到一个神器来帮助我们更好的学习前端开发,要么记事本怎么样?不错是不错估计要写到猴年马月了. 百度一搜,web前端开发利器有很多,比如:EditPlus,Dreamweaver,HBuilder,Webstorm,Aptana Studio,Sublime text,这么多最后我还

【Web小技巧】右键使用Sublime Text打开文件夹

在web学习或开发中,会接触到各种Demo代码或者Github上的开源代码.要是每次都打开Sublime Text,然后把文件夹拖到里面,以打开一个文件夹,无疑是一件繁琐的事情.当然,你也可以使用Sublime Text里的project功能,不过个人觉得还是不够便捷.为什么不能在文件夹的右键菜单上添加一个"用Sublime Text打开"这样的菜单,直接打开呢?ok,懒人的方法来了. 基本步骤如下: 打开注册列表编辑器,win+R打开运行工具,输入regedit 点开HKEY_CLA

Web前端开发:Sublime Text 常用插件

在安装这些插件之前,确保你已经安装了Package Control. 安装Package Control方法: 通过菜单栏View->Show Console 或者快捷键Ctrl+` 打开控制台.复制以下代码按Enter即可 Sublime Text 3版本: import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Pa

【Web】Sublime Text 3 连接sftp/ftp(远程服务器)

在 Win 下常用 Xftp 软件来和远程服务传递文件,但是要是在项目开发的时候频繁的将远程文件拖到本地编辑然后再传回远程服务器,那真是麻烦无比,但是Sublime中SFTP插件,它让这世界美好了许多.Sublime下的SFTP,只要 Ctrl+S 即可同步本地到服务器 使用步骤 1.安装Sublime Text 3 编辑器,参照:[Web]Sublime Text 3 安装+注册+汉化 2.安装sftp插件 a.打开Package Control,搜索Install Package    b.

最好的Sublime Text插件集合

阅读目录 WebInspector Emmet Git GitGutter & Modific Sublimall AllAutocomplete SublimeREPL DocBlockr Floobits AutoFileName ColorPicker PlainTasks MarkdownEditing Finally WebInspector Amazing tool for debagging JavaScript, the full-fledged inspector of a c