• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in

modular-snippets

A modular solution to snippets in Atom.
  • #snippets
  • #modular
  • #config
danielbayley
0.1.3 1,364
12
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

apm

Modular Snippets

A modular solution to snippets in Atom.

Any valid snippets (.cson) file inside ATOM_HOME/snippets/** will be loaded automatically, or reloaded if modified.

This package does not interfere with the existing snippets.cson, so you can slowly transition to this more modular approach.

The Atom Snippets… menu item will be overridden to open your snippets folder in a new window, along with the default snippets.cson if it still exists.

Your snippets will be automatically added to the list of extra backup files if the sync-settings package is installed.

Project Snippets

Some snippets may only be relevant to a particular project, so it makes sense to store them with that project; these could then be committed to version control and shared between a team. These local snippets are loaded from the first item found in the root of your project base on the following order:

  • [.]snippets.cson
  • [.]snippets/**/*.cson
  • snippets: {object} in package.json
  • snippets: {object} in project.cson

API

This package also provides a service to load any snippets {object}, file or folder…

// package.json 
"consumedServices": {
  "modular-snippets": {
    "versions": {
      "^1.0.0": "consume"
    }
  }
},
# index.coffee 
{Disposable} = require 'atom'
 
snippet = { # object }, file or folder. 
  '.source.coffee':
    Snippet:
      prefix: 'prefix'
      body: 'snippet'
}
consume: (@snippets) ->
  new Disposable => stopUsingService @snippets
 
@snippets.load snippet

Install

apm install modular-snippets or search “snippets” under packages within Atom.

License

MIT © Daniel Bayley

Thanks to @thibmaek for the base repository.

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by