A snippet for initializing debug on sublime text
I use debug pretty religously. This is an example initialisation:
const log = require('debug')('MyApp:FooFile.js:log');
const error = require('debug')('MyApp:FooFile.js:error');
But doing that for each FooFile.js manually is cumbersome at best. So, I use this snippet:
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
const log = require('debug')('$TM_FILENAME:log');
const error = require('debug')('$TM_FILENAME:error');
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dbg</tabTrigger>
<description>filename:debug</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
And then you can do dbg (whatever's inside tabTrigger element), and then You have initiated logs!

Note: I originally published this here.
Written by Nadeesha Cabral
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Debug
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#