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

emmet-gen

v1.7.3

Published

emmet-gen is a CLI tool for generating directories and files with emmet inspired syntax.

Downloads

13

Readme


Getting started

Installation

  • Download and install Node.js.
  • Before emmet-gen can be used, it should be initialized with the command
npx emmet-gen init
  • emmet-gen can be used in any sub-directory. emmet-gen will search up the file tree for emmet-gen-template.json.

Usage

Templates

  • Emmet-gen will use the templates in the emmet-gen-template directory.
  • Every directory at the top level of the emmet-gen-template is a template route.
  • The name of the template will be the name used as a class or id.
  • Any name or text within a file with __TemplateName__ will be replaced by the tag of the template.
  • Each template must contain exactly 1 directory or file at the top.
  • Directories can have any amount of files and subdirectories.

Commands

Emmet

  • Emmet-gen with parse a string argument with emmet-like syntax.
  • It should be noted depending on your terminal shell you will have to escape some special characters.
  • Here are the following syntax supported by emmet-gen using bash.

Child: >

makes the following tag a child

npx emmet-gen hello\>world

Sibling: +

add the following tag as a sibling

npx emmet-gen hello+world

Climb-up: ^

directs the following tag up the tree

npx emmet-gen hello\>to+the^world

Item numbering: $

Multiplication: *

multiplies a tag NOTE: items multiplied must have $ numbering to prevent overwriting each other

npx emmet-gen hello\>world\$\*5

Multiplication initial count: @

multiplies a tag starting from a count

npx emmet-gen hello\>world\$\@5*10

ID: #

sets the template of the preceding tag

npx emmet-gen hello\>world#file

CLASS: .

sets the template of the preceding tag and subsequent templates.

npx emmet-gen hello.file

Replace Contents: [target="substitute"]

replaces target text within a file with the substitute text NOTE: substitute must be wrapped in double quotes

npx emmet-gen hello[log=\"error\"]

empty: /

mark the following tag as an empty directory. If chained a tag will make the directory a child. Empty tags will not influence the template inheritance.

npx emmet-gen /hello/world

Grouping: ()

wraps tags. Can be used with multiply.

npx emmet-gen hello\>\(to\$+the\$+world\$\)\*5
  • emmet commands will by default create templates relative terminal's working directory.
  • This can be changed in the emmet-gen-template.json by "relative": false, and the default directory will be absolutely bound to the directory which contains the emmet-gen-template.json

Index

  • emmet-gen also can be used to generate index files using es6 importing syntax for JavaScript/Typescript files.
  • If a path isn't specified, emmet-gen will use the current working directory.
npx emmet-gen index ./hello
  • The --recursive or -r flag can be used to recursively generate index files.
npx emmet-gen index ./hello -r
  • For emmet commands, the --index or -i flag can be used to recursively generate index files for templates.
npx emmet-gen hello\>\(to\$+the\$+world\$\)\*5 -i
  • Index files with be generated without the flag by changing the emmet-gen-template.json by "auto_imports": true,

Init

  • Emmet-gen templates can be saved and retrieved from a local JSON file.
  • The --save or -s flag with create an emmet-save.json with data of your templates and emmet-gen-templates.json in the same directory as the emmet-gen-template.json.
npx emmet-gen init -s
  • The --load or -l flag with read emmet-save.json and generate templates and emmet-gen-templates.json in the working directory.
npx emmet-gen init -l
  • Emmet-gen also supports remote cloud saving and loading as well.
  • Adding a name after the save flag will upload the templates. NOTE: Every template name uploaded is unique and uploading with the same name will overwrite the previous template.
npx emmet-gen init -s nick3point5-example
  • Similarly loading from the cloud will be done if a name is provided.
npx emmet-gen init -l nick3point5-example