atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

Can I create snippets in init.coffee programly? #181

Open giyyapan opened 8 years ago

giyyapan commented 8 years ago

Hi all! I've got some snippets used in different scops (<{tagName}></{tagName}> for both html and jsx for example), and I have to write them many times in snippets.cson for different scrops.

So is there a way to add a snippets programly with some atom api like atom.snippets.add(scope, snippets), so I can do

htmlSnippets =
  '<tag></tag>':
    prefix:'t'
    body:"""
      <${1:tagName} $0></${1:tagName}>
    """
atom.snippets.add(scope,htmlSnippets) for scope in ['.text.html','.source.coffee']

Thanks!