Package Exports
- emmet-gen
- emmet-gen/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (emmet-gen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
emmet-gen
An un-opinionated file template CLI system that works with syntax inspired by emmet.
Getting started
Installation
- 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 of
emmet-gen-templateis 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. The top directory 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\>worldSibling: +
add the following tag as a sibling
npx emmet-gen hello+worldClimb-up: ^
directs the following tag up the tree
npx emmet-gen hello\>to+the^worldItem numbering: $
Multiplication: *
multiplies a tag NOTE: items multiplied must have $ numbering to prevent overwriting each other
npx emmet-gen hello\>world\$\*5ID: #
sets the template of the preceding tag
npx emmet-gen hello#file\>worldCLASS: .
sets the template inheritance of the preceding tag and its children.
npx emmet-gen hello.fileCustom Replace: [target="substitute"]
replaces target text within a file with the substitute text NOTE: substitute must be wrapped in double quotes
npx npx emmet-gen hello.file[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/worldGrouping: ()
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 changed in the emmet-gen-template.json by
"auto_imports": true,.