If sharing snippets with your team is the goal, I’d probably create a
snippets-team package that includes all the snippets you’d like to share between your team-members and push it to a git repository. This allows for easy installation for every team member:
git clone https://snippets-team-package-git-url.git
It is also possible to organize your snippets in a separate folder, albeit in a hacky way, by using the internals of the
snippets package. If you want stability over performance, consider simply concatenating all snippets into
~/.atom/snippets.cson at start-up, which can be easily done inside your init script. The approach below can potentially break every time Atom gets updated, so be careful!
Example folder structure:
│ ├─┬ init/
│ │ └── import-snippets.coffee
│ └─┬ snippets/
│ ├── my-snippet-one.cson
│ └── my-snippet-two-cson
# Import Snippets
path = require 'path'
# Get a reference to the `snippets` package.
snippets = atom.packages.getLoadedPackage 'snippets'
# Get a reference to the `snippets.js` file inside the `snippets` packages' `lib` folder.
Snippets = require path.join snippets.mainModulePath, '..', 'snippets.js'
# The directory to load the snippets from, e.g. `~/.atom/customization/snippets`.
snippetsDirectory = path.join atom.getConfigDirPath(), 'customization', 'snippets'
# Load all snippets from the `snippetsDirectory` directory.
Snippets.loadSnippetsDirectory snippetsDirectory, (ignoreNull, snippetsInSnippetsDirectory) ->
for filepath, snippetsBySelector of snippetsInSnippetsDirectory
Snippets.add filepath, snippetsBySelector
Once you’ve set that up, all the snippets you place inside the
~/.atom/customization/snippets folder will be automatically loaded when you start Atom.