Sublime Forum

Trying to add a snippet & getting error

#1

I’m trying to add a new snippet that I will use most likely for new javascript files. Here is my snippet code.

[code]
<![CDATA[;(function ($, window, undefined) {
“use strict”;

		var ${1:global_namespace} = {

		};

		$(document).ready(function () {
			app.init();
		});

		window.app = app || {};
	}(jQuery, this));
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>anon</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<!-- Optional: Description to show in the menu -->
<description>Anonymous self-executing function</description>
[/code]

And the error I get is:

What gives? What am I doing wrong?

0 Likes

#2

It’s not happy with the standalone $ symbol on the first line, it needs to be escaped, by turning it into $

0 Likes

#3

Thank you for the heads up but that didn’t fix it. I’m getting the same error.

0 Likes

#4

You need to escape the other $ symbol, too

0 Likes

#5

Oh my lord, I’m an idiot.

Thank you very much!

0 Likes