You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cli-usage.md 1.8KB

7 years ago
7 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. +++
  2. title = "CLI usage"
  3. weight = 2
  4. +++
  5. Gutenberg only has 3 commands: init, build and serve.
  6. You can view the help of the whole program by running `gutenberg --help` and
  7. the command help by running `gutenberg <cmd> --help`.
  8. ## init
  9. Creates the directory structure used by Gutenberg at the given directory.
  10. ```bash
  11. $ gutenberg init <my_site>
  12. ```
  13. will create a new folder named `my_site` and the files/folders needed by
  14. Gutenberg.
  15. ## build
  16. This will build the whole site in the `public` directory.
  17. ```bash
  18. $ gutenberg build
  19. ```
  20. You can override the config `base_url` by passing a new URL to the `base-url` flag.
  21. ```bash
  22. $ gutenberg build --base-url $DEPLOY_URL
  23. ```
  24. This is useful for example when you want to deploy previews of a site to a dynamic URL, such as Netlify
  25. deploy previews.
  26. +You can override the default output directory 'public' by passing a other value to the `output-dir` flag.
  27. ```bash
  28. $ gutenberg build --output-dir $DOCUMENT_ROOT
  29. ```
  30. ## serve
  31. This will build and serve the site using a local server. You can also specify
  32. the interface/port combination to use if you want something different than the default (`127.0.0.1:1111`).
  33. You can also specify different addresses for the interface and base_url using `-u`/`--base-url`, for example
  34. if you are running Gutenberg in a Docker container.
  35. ```bash
  36. $ gutenberg serve
  37. $ gutenberg serve --port 2000
  38. $ gutenberg serve --interface 0.0.0.0
  39. $ gutenberg serve --interface 0.0.0.0 --port 2000
  40. $ gutenberg serve --interface 0.0.0.0 --base-url 127.0.0.1
  41. $ gutenberg serve --interface 0.0.0.0 --port 2000 --output-dir www/public
  42. ```
  43. The serve command will watch all your content and will provide live reload, without
  44. hard refresh if possible.
  45. Gutenberg does a best-effort to live reload but some changes cannot be handled automatically. If you
  46. fail to see your change, you will need to restart `gutenberg serve`.