Sublime Forum

Snippets in CSS

#1

Hi guys,

This is probably easy for most of you but I can’t make this thing work. I have a snippet I want to use inside CSS file. This snippet just add a comment that I’m using as divider. Snippet is saved inside “User” folder. This is the code:

[code]

<![CDATA[
/* ${1:Add comment title here}
---------------------------------------------*/

$0
]]>

csst

CSS comment title
[/code]
Now, this snippet works inside HTML file, and also works inside CSS file when I type “csst+tab” inside brackets like this: .test {csst+tab}. But, I actually need this to add comment outside class. How I can make this work?

Thanks!

0 Likes

#2

Because there’s no element in the snippet, it should work everywhere.

Keep in mind that snippets in Sublime Text are triggered via key bindings: you have to type exactly c,s,s,t,tab without using backspace etc.

0 Likes

#3

Hi jps, thanks for reply. As I described this snippet works in CSS file too but only when it’s triggered between brackets { }. I need this to work outside brackets, at a beginning of the CSS document for example or in between classes, not inside.

0 Likes

#4

did you ever find a solution to this? still having this same problem

0 Likes

#5

I have the same trouble when dealing with snippets in css file and find a way by binding key to sovle it temporarily .

stackoverflow.com/questions/1450 … ime-text-2

Very strange that seems no one cares.

0 Likes

#6

I’ve just noticed this same issue, and I definitely care!

Exactly like you said, the snippet works fine when triggered inside a current definiton (ie brackets { } ), but doesn’t work where I’d like it to, which is just anywhere in the file.

I had the same purpose in mind as you, which was to use it as an easy way to create a comment. The keyword “cm” makes a regular comment, but I wanted to create a block comment with three lines to define sections in my CSS file.

0 Likes