Home Download Buy Blog Forum Support

Snippets in CSS

Snippets in CSS

Postby Giuliano on Fri Sep 03, 2010 7:10 pm

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: Select all
<!-- See http://www.sublimetext.com/docs/snippets for more information -->
/* ${1:Add comment title here}

   <!-- Optional: Tab trigger to activate the snippet -->
   <!-- Optional: Description to show in the menu -->   
   <description>CSS comment title</description>

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?

Posts: 2
Joined: Fri Sep 03, 2010 5:21 pm

Re: Snippets in CSS

Postby jps on Sun Sep 05, 2010 12:51 am

Because there's no <scope> 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.
Site Admin
Posts: 3217
Joined: Wed Mar 19, 2008 12:33 pm

Re: Snippets in CSS

Postby Giuliano on Tue Sep 07, 2010 1:25 pm

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.
Posts: 2
Joined: Fri Sep 03, 2010 5:21 pm

Re: Snippets in CSS

Postby edenchen on Wed Jan 29, 2014 10:10 am

did you ever find a solution to this? still having this same problem
Posts: 1
Joined: Wed Jan 29, 2014 10:09 am

Re: Snippets in CSS

Postby bobscript on Thu May 15, 2014 2:24 am

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

http://stackoverflow.com/questions/1450 ... ime-text-2

Very strange that seems no one cares.
Posts: 1
Joined: Thu May 15, 2014 2:17 am

Re: Snippets in CSS

Postby brettmorgan on Wed Jun 18, 2014 4:19 pm

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.
Posts: 2
Joined: Wed Jun 18, 2014 4:17 pm

Return to Technical Support

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 14 guests