Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and use the new build command #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ Contributions to the scriggo.com site are greatly appreciated, as new documentat
* if you find an issue on the site, [open an issue](https://github.com/open2b/scriggo/issues/new) on Scriggo.
* if you want to write new documentation, as "Switch from X to Scriggo", [discuss with us](https://github.com/open2b/scriggo/discussions) and after it is approved open a PR on this repository.
* if you use Scriggo at work, let us know.

### Running the website

The scriggo.com site is a Scriggo template. You can use the [scriggo command](https://scriggo.com/scriggo-command) to run it locally:

```
cd site
cd src
scriggo serve
```

### Build the website

To build the pages of the website, execute the following command in the root directory of the repository:
To build the pages of the website, execute the following commands:

```
go run .
cd src
scriggo build -o ../public
```

It will create a new directory named "public" with the compiled site pages. If the directory already exists, it will be deleted first.
It will create a new directory named "public" in the root directory to contain the compiled site pages. If a directory
named "public" already exists, it will first be deleted.
10 changes: 0 additions & 10 deletions go.mod

This file was deleted.

8 changes: 0 additions & 8 deletions go.sum

This file was deleted.

223 changes: 0 additions & 223 deletions main.go

This file was deleted.

9 changes: 9 additions & 0 deletions site/news.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

# News

## Released Scriggo v0.58.1
December 05, 2024

This release adds the `build` command to Scriggo, allowing you to build an entire template from the command line.

### Changes

* [cmd/scriggo: add the build command to build a template](** TODO **) **TODO **

## Released Scriggo v0.58.0
December 04, 2024

Expand Down
2 changes: 1 addition & 1 deletion site/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
%%}
<nav class="top">
<a class="logo" href="/"><img src="/images/scriggo.svg" width="107" alt="Scriggo" title="Scriggo"></a>
<a class="version" href="https://github.com/open2b/scriggo/releases">v0.58.0</a>
<a class="version" href="https://github.com/open2b/scriggo/releases">v0.58.1</a>
<ul>
<li><a href="/news"{% if filepath == `news` %} class="selected"{% end %}>News</a></li>
<li><a href="/what-is-scriggo"{% if isDocFile(filepath) %} class="selected"{% end %}>Documentation</a></li>
Expand Down
52 changes: 49 additions & 3 deletions site/scriggo-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

Scriggo has a command line interface, the `scriggo` command, that allows to:

- [Build a template directory](#build-a-template-directory)
- [Examples](#examples)
- [Run a template file](#run-a-template-file)
- [Complete syntax](#complete-syntax)
- [Examples](#examples)
- [Examples](#examples-1)
- [Serve a template](#serve-a-template)
- [Complete syntax](#complete-syntax-1)
- [Initialize an interpreter](#initialize-an-interpreter)
Expand All @@ -33,15 +35,14 @@ then test if `scriggo` can be executed:

```shell
$ scriggo version
scriggo version v0.58.0 (go1.23)
scriggo version v0.58.1 (go1.23)
```

If the `scriggo` command is not found, you should add the directory where the command has been installed to your `PATH`.

`go` installs the `scriggo` command in the directory named by the `GOBIN` environment variable. If it is not set it
defaults to `$GOPATH/bin` or, if the `GOPATH` environment variable is not set, to `$HOME/go/bin`.


### Get help from command line

To get help from the command line run the following command:
Expand All @@ -50,6 +51,51 @@ To get help from the command line run the following command:
$ scriggo help
```

## Build a template directory

The Scriggo `build` command builds the template rooted at the current directory and writes the generated files to a
directory named `public` by default. If the `public` directory already exists, it is deleted along with all its
content before writing the new files.

The `build` command takes the following form:

```shell
$ scriggo build [-o output] [dir]
```

For example:

```shell
scriggo build
```

builds the template rooted at the current directory and writes the resulting files to a directory named `public`.

The `-o` flag writes the result to the specified output directory instead of the default `public`.

If the `dir` parameter is specified, it builds the template located in that directory instead of the current directory.

Markdown is converted to HTML using the Goldmark parser with the options `html.WithUnsafe`, `parser.WithAutoHeadingID`,
`extension.GFM`, and `extension.Footnote`. Non-template files, such as CSS and JavaScript, are copied as-is.

### Examples

```shell
$ scriggo build
```

```shell
$ scriggo build docs
```

```shell
$ scriggo build -o /var/www
```

```shell
$ scriggo build -o ../public site
```

## Run a template file

The Scriggo Run command runs a template file and its extended, imported and rendered files. All Scriggo builtins are
Expand Down
Loading