Last active
August 29, 2015 14:09
-
-
Save lencioni/230b8e61ae6d08898aac to your computer and use it in GitHub Desktop.
require() JavaScript snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet re "require" b | |
var `!p | |
def formatVariableName(path): | |
lastPart = path.split('/')[-1] | |
if lastPart == 'underscore': | |
return '_' | |
elif lastPart == 'jquery': | |
return '$' | |
else: | |
return re.sub(r'[_\-]', '', lastPart.title()) | |
snip.rv = formatVariableName(t[1]) | |
` = require('${1}');$0 | |
endsnippet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment