npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

c-snippet

v2.0.8

Published

Convert snippets from any code editor (TS)

Downloads

43

Readme

C-Snippet

Convert snippets from any code editor

npm version npm downloads license

C-Snippet Screenshot

🚀 Description

C-Snippet is a TypeScript-based tool that allows you to convert snippets from one code editor's format to another. It provides a command-line interface (CLI) for converting and saving snippets to the desired output format.

📦 Installation

To install C-Snippet, you can use npm:

npm install -g c-snippet

💡 Usage

After installation, you can use the c-snippet command to run the tool. The CLI will guide you through the conversion process by asking you a series of questions. Here's how to use it:

c-snippet

Follow the prompts to select the source editor, target editor(s), input snippets, and output path. C-Snippet will then parse, convert, and save the snippets accordingly.

One line command

You can also run the tool in a single command by passing the required options as arguments. Here's an example:

c-snippet -f vscode -t atom -s ./snippets -o ./output

The above command will convert all snippets from the ./snippets folder to Atom format and save them to the ./output folder.

Options

| Option | Description | | --- | --- | | -f, --fromEditor <editor> | The source editor. | | -t, --toEditor <editor> | The target editor(s). | | -s, --snippetsPath <path> | The path to the input snippets. | | -o, --outputPath <path> | The path to the output snippets. |

📜 Scripts

  • npm start: Build and run the tool in a single command.
  • npm run start:linux: Same as npm start, but for Linux users (clears terminal before running).
  • npm run build: Compile TypeScript code.
  • npm test: Run Jest tests.
  • npm run repo:commit: Stage, commit, and push changes to the repository.

📦 Supported Editors

🤝 Contributing

Contributions to C-Snippet are welcome! If you find a bug, have a feature request, or want to contribute code, please open an issue or submit a pull request on the GitHub repository.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.



Instructions for Generated Snippet Files 📝✂️

Visual Studio Code 👓

  1. Open the editor and select:

      File > Preferences (Code > Preferences on macOS)
  2. Choose the option: "New global snippets file"

  3. Copy all the snippets from the generated file into the newly opened VS Code snippets file.

  4. Save, close VS Code, and you're all set! ✨

Atom 🚀

  1. Open Atom and navigate to:

     File > Snippets
  2. This will open Atom's snippets file. Copy the generated snippets into that file.

If you want to add snippets from different languages in the same file, separate them like this:

// GLOBAL 
'*':
    'nameSnippets':
        'prefix': 'snip' (trigger)
        'body': '<tag> code </tag>'
    'nameSnippets':
        'prefix': 'snip' (trigger)
        'body': '$(document).someFunction({})'
// HTML
'.text.html.basic':
    // ...
// CSS
'.text.css':
    // ...

Sublime Text 📄

  1. Open Sublime:

    • You can save the generated snippets folder to your Packages/User folder and then reload Sublime Text.
    • To find Packages/User, follow these paths for different versions:
    Sublime 2
     - Windows: %APPDATA%\Sublime Text 2
     - OS X: ~/Library/Application Support/Sublime - Text 2
     - Linux: ~/.config/sublime-text-2
    Sublime 3
     - Windows: %APPDATA%\Sublime Text 3
     - OS X: ~/Library/Application Support/Sublime - Text 3
     - Linux: ~/.config/sublime-text-3
    Sublime 4
     - Windows: %APPDATA%\Sublime Text
     - OS X: ~/Library/Application Support/Sublime Text
     - Linux: ~/.config/sublime-text 
  2. Copy the folder

Dreamweaver ☁️

  1. Locate the Dreamweaver folder:

     C:\Users\%USERNAME%\AppData\Roaming\Adobe\Dreamweaver

You may find folders from different versions. Look for the folder "en_US" or your language folder. Then go to "Configuration/snippets". Copy the folder with the generated snippets into this location.

  1. After copying the generated snippets folder (DO NOT change the folder name, as triggers may not work), copy the "dwSnippets.json" file into the snippets folder (not the generated one), as it contains triggers for all snippets.

If a "dwSnippets.json" file already exists, DO NOT DELETE IT. Copy the added content into that file. Pay attention to the object structure.