To install through Package Control, search for JavaScript & NodeJS Snippets. If you still don't have Package Control in Sublime Text, go get it. It's pure awesomeness.
If you insist to not install it, you can download the package and
put it manually inside your Pacakages
directory. It should work but will not update automatically.
console.dir(${1:obj});
console.error(${1:obj});
console.log(${1:obj});
console.warn(${1:obj});
${1:document}.addEventListener('${2:event}', function(e) {
${3:// body...}
});
${1:document}.appendChild('${2}');
${1:document}.removeChild('${2}');
${1:document}.createElement('${2:elem}');
${1:document}.createDocumentFragment();
${1:document}.classList.add('${2:class}');
${1:document}.classList.toggle('${2:class}');
${1:document}.classList.remove('${2:class}');
${1:document}.getElementById('${2:id}');
${1:document}.getElementsByClassName('${2:class}');
${1:document}.getElementsByTagName('${2:tag}');
${1:document}.getAttribute('${2:attr}');
${1:document}.setAttribute('${2:attr}', ${3:value});
${1:document}.removeAttribute('${2:attr}');
${1:document}.innerHTML = '${2}';
${1:document}.textContent = '${2}';
${1:document}.querySelector('${2:selector}');
${1:document}.querySelectorAll('${2:selector}');
${1:myArray}.forEach(function (${2:elem}) {
${3:// body...}
});
[].forEach.call(document.querySelectorAll(${1:selector}), function (${2:elem}) {
${3:// body...}
});
for (var ${1:prop} in ${1:obj}) {
if (${1:obj}.hasOwnProperty(${1:prop})) {
${3:// body...}
}
}
function ${1:methodName} (${2:arguments}) {
${3:// body...}
}
${1:ClassName}.prototype.${2:methodName} = function(${3:arguments}) {
${4:// body...}
}
(function (window, document, undefined) {
${1:// body...}
})(window, document);
setInterval(function() {
${2:// body...}
}, ${1:delay});
setTimeout(function() {
${2:// body...}
}, ${1:delay});
assert.equal(${1:actual}, ${2:expected});
assert.deepEqual(${1:actual}, ${2:expected});
assert.notEqual(${1:actual}, ${2:expected});
module.exports = ${1}
process.exit(${1:code});
require('${1:module}');
'use strict';
- Add BDD snippets
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
- v0.1.5 August 15, 2013
- Added
forEach
,forEachCall
,for in
,iife
anduse strict
snippets
- Added
- v0.1.4 August 15, 2013
- Added
createDocumentFragment
andremoveChild
snippets - Renamed
appendChild
snippet filename
- Added
- v0.1.3 August 14, 2013
- Fixed duplicated [ce] shortcut
- v0.1.2 August 14, 2013
- Added timer function snippets
- v0.1.1 August 14, 2013
- Added NodeJS assert snippets
- v0.1.0 August 14, 2013
- Added console and function snippets
- Added DOM manipulation snippets
- Added NodeJS snippets
MIT License © Zeno Rocha