fragment → Documentation → API → CLI
Once fragment
is properly installed, you can launch it and create sketches from the command line.
Create a new sketch.
fragment create [filename]
Flag | Shortcut | Description | Default |
---|---|---|---|
--template |
-t |
Prepopulate template choice | 2d |
fragment create sketch.js
Run an existing sketch.
fragment run [filename]
The command run
can be omitted since it's the default command
fragment [filename]
Flag | Shortcut | Description | Default |
---|---|---|---|
--port |
-p |
Specify the server port. | 3000 |
--exportDir |
none | Override directory used for exports | undefined |
--new |
-n |
Redirect to create prompts | false |
--template |
-t |
Pre-populate template choice in create prompts | 2d |
--build |
-b |
Redirect to build prompts | false |
--outDir |
none | Pre-populate outDir in build prompts | [/[sketch-name] |
--emptyOutDir |
none | Pre-populate emptyOutDir in build prompts | false |
--base |
none | Pre-populate base path in build prompts | undefined |
--development |
none | Run Fragment in development mode | false |
--prompts |
none | Enable interactive prompts in build prompts | true |
Build a sketch into static files for production.
fragment build [filename]
Flag | Shortcut | Description | Default |
---|---|---|---|
--outDir |
none | Pre-populate out directory | [/[sketch-name] |
--emptyOutDir |
none | Empty outDir before static build | false |
--base |
none | Base public path when served in production | undefined |
--development |
none | Run Fragment in development mode | false |
--prompts |
none | Enable interactive prompts | true |
Start a local server to preview a sketch built locally with fragment build
.
fragment preview [directory]
fragment
currently has the following templates: