Skip to content

Instantly share code, notes, and snippets.

@sapphiriq
Last active August 29, 2015 14:07
Show Gist options
  • Save sapphiriq/60a89f7197719888630d to your computer and use it in GitHub Desktop.
Save sapphiriq/60a89f7197719888630d to your computer and use it in GitHub Desktop.
SublimeText Javascript/Coffeescript snippets for require

Autonaming variables

// req<TAB>
var webpackDevServer = require('webpack-dev-server');
var merge = require('react/lib/merge');
var Store = require('../stores/Store');
$ git clone https://gist.github.com/60a89f7197719888630d.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/JSRequireSnippets
<snippet>
<content><![CDATA[
${2:${1/([-_]([a-z]))|(^.*\/([^\/]+)$)/(?2\U\2)(?3\4)/g}} = require '${1:package-name}'$0
]]></content>
<tabTrigger>req</tabTrigger>
<scope>source.coffee</scope>
</snippet>
<snippet>
<content><![CDATA[
var ${2:${1/([-_]([a-z]))|(^.*\/([^\/]+)$)/(?2\U\2)(?3\4)/g}} = require('${1:package-name}');$0
]]></content>
<tabTrigger>req</tabTrigger>
<scope>source.js</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment