CLI and API for easily creating, reusing, sharing and generating snippets of code from the command line.
presets
json
or yaml
files, or using expand-objectMore to come!
Install with npm
var snippet = require('snippet');
(WIP! This is just one feature of Snippet
! A lot more is on the way!)
Expand emmet snippets
snippets.expand('ul>li.item$*3');
Results in:
<ul> <li class="item1"><%= param0 %></li> <li class="item2"><%= param1 %></li> <li class="item3"><%= param2 %></li> </ul>
Expand emmet snippets with custom placehoders
snippets.expand('ul>li.item$*3', ['a', 'b', 'c']);
Results in:
<ul> <li class="item1"><%= a %></li> <li class="item2"><%= b %></li> <li class="item3"><%= c %></li> </ul>
Create an instance of Snippets
with the given options.
Params
options
{Object}Example
var Snippets = require('snippets'); var snippets = new Snippets();
Cache a snippet or arbitrary value in memory.
Params
name
{String}: The snippet nameval
{any}returns
{Object}: Returns the Snippet
instance for chainingCache a snippet in memory. Creates a Snippet
instance with the given value
.
Params
name
{String}: The snippet nameval
{any}returns
{Object}: Returns the Snippet
instance for chainingCreate a new Snippet()
from a snippet object, or array of snippet objects.
Params
snippets
{Object|Array}Persist a snippet or arbitrary value to disk.
Params
name
{String}val
{any}returns
{Object}: Returns the Snippet
instance for chainingGet a snippet or arbitrary value by name
. Cached, local, or remote.
Params
name
{String}preset
{Object}: Preset to use if a URL is passed.returns
{Object}: Returns the requested snippet.Delete snippet name
from memory and/or snippet-store. This will not delete actual snippet files saved on disk, only cached snippets.
Params
name
{String}: The name of the snippet to deletereturns
{Object} Snippets
: instance, for chainingLoad a glob of snippets.
Params
options
{Object}returns
{Object} Snippets
: for chainingRead a snippet from the file system. If the snippet is already in memory and is an instance of Snippet
, the .read()
method is called on the snippet. Otherwise, a new Snippet()
is created first before calling the .read()
method on the snippet.
Params
returns
{Object}Set a preset config
for downloading snippets from a remote URL.
Params
name
{String}config
{Object}returns
{Object}Queue a remote snippet to be downloaded from the given URL, and optional preset
.
Params
url
{String}preset
{Object}: The namereturns
{Object}: Returns a snippet object.Fetch a remote snippet from the given URL.
Params
url
{String}preset
{Object}returns
{Object}: Returns a snippet object.Expand a snippet of code or data.
Params
str
{String}Install dev dependencies:
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 13, 2015.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4