🎉 The Gowebly CLI has grown to v2.0.0
Tags: showdev, go, webdev, news
Published: 2024-01-11 07:45:29

## Introduction

Happy New Year, my DEV friends! 🎊

While everyone was relaxing and thinking about Christmas, I was hard at work in my studio to prepare a massive update for the [Gowebly][gowebly_url] CLI number `v2`.

I don't like to drag out the intro, so here we go! 😉

<a name="toc"></a>
### 📝 Table of contents

- [What is Gowebly?](#what-is-gowebly)
- [Breaking changes](#breaking-changes)
- [Live reload mode on code updates](#live-reload-mode-on-code-updates)
- [Other notable improvements](#other-notable-improvements)

<a name="#what-is-gowebly"></a>
## What is Gowebly?

A next-generation CLI tool that makes it easy to create amazing web applications with **Go** on the backend, using **htmx** & **hyperscript** and the most popular **CSS frameworks** on the frontend.

{% github no-readme github.com/gowebly/gowebly %}

[↑ Table of contents](#toc)

<a name="#breaking-changes"></a>
## Breaking changes

After gathering the opinion of the most active users and based on the experience of my other successful CLI project [Create Go App][cgapp_url], I decided to **remove** the possibility of configuring with a YAML file.

> ✨ Yes, `.gowebly.yml` is no longer needed!

The handy and incredibly beautiful [huh][huh_url] library from the [Charm][charm_url] team is now in charge of that. Just upgrade to the latest version of the Gowebly and type the familiar command in the terminal:

```bash
gowebly create
```

And just look at this:

![new gowebly create](https://raw.githubusercontent.com/gowebly/.github/main/images/gowebly_create.gif)

The same thing happened with the unknown and the `doctor` commands, which now look (and feel) completely different:

```bash
gowebly doctor
```

![new gowebly doctor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0muxcjo87jw2ukffc27x.png)

[↑ Table of contents](#toc)

<a name="#live-reload-mode-on-code-updates"></a>
## Live reload mode on code updates

It was highly anticipated, and I decided not to delay and make it as soon as possible. Since version `v2.0.0`, the Gowebly CLI supports reloading a project running in development mode if changes are made to it:

1. Go code;
2. Templ or HTML templates;
3. SASS/CSS styles;
4. TypeScript/JavaScript files;
5. Frontend part settings (JSON).

This is made possible thanks to the [Air][air_url] tool, which now comes with every project you create. The configuration is as follows:

```toml
# .air.toml

root = "."
tmp_dir = "tmp"

[build]
pre_cmd = ["bun run build"]
cmd = "templ generate && go build -o ./tmp/gowebly_default ."
bin = "tmp/gowebly_default"
include_ext = ["go", "templ", "html", "json", "js", "ts", "css", "scss"]
exclude_dir = [".parcel-cache", "bin", "dist", "node_modules", "static", "tmp", "tests", "vendor"]
exclude_regex = ["_test\\.go", "_templ\\.go"]
exclude_unchanged = false
follow_symlink = false
log = "build-errors-air.log"
poll = false
poll_interval = 500
delay = 1000
stop_on_error = true
send_interrupt = false
kill_delay = 500
rerun = false
rerun_delay = 500

# ...
```

If you don't want to use **Air**, when creating a new project, select _"No"_ when the CLI prompts you to use the tool. In this case, this [Makefile][gowebly_makefile_url] will be created.

[↑ Table of contents](#toc)

<a name="#other-notable-improvements"></a>
## Other notable improvements

The backend has been completely reimagined:

1. Repetitive elements in templates have been removed;
2. The configs for creating a Docker container have been simplified;
3. Add the [htmx-go][htmx_go_url] package to simplify the [htmx][htmx_url] handling at the server layer of the application.

The frontend part has received the following refresh:

1. Repetitive elements in templates have been removed;
2. Add a `./assets/scripts.js` file for your reactive logic;
3. Add the [Flowbite][flowbite_url] components library for the Tailwind CSS;
4. Add the [Prettier][prettier_url] for code formatting.

And not only that! 😊 Keep an eye out for updates and new releases on the project's [GitHub][gowebly_releases_url] page and [official documentation][gowebly_docs_url].

[↑ Table of contents](#toc)

<a name=""></a>
## Photos and videos by

- Vic Shóstak https://github.com/koddr

<!-- Article links -->

[gowebly_docs_url]: https://gowebly.org
[gowebly_releases_url]: https://github.com/gowebly/gowebly/releases
[gowebly_makefile_url]: https://github.com/gowebly/gowebly/blob/main/internal/attachments/templates/misc/Makefile.gotmpl

[huh_url]: https://github.com/charmbracelet/huh
[charm_url]: https://charm.sh/
[air_url]: https://github.com/cosmtrek/air
[htmx_url]: https://htmx.org
[htmx_go_url]: https://github.com/angelofallars/htmx-go
[flowbite_url]: https://flowbite.com
[prettier_url]: https://prettier.io

<a name=""></a>
## P.S.

If you want more articles (like this) on this blog, then post a comment below and subscribe to me. Thanks! 😻

And of course, you can help me make developers' lives even better! Just connect to one of my projects as a contributor. It's easy!

My main projects that need your help (and stars) 👇

- 🔥 [Gowebly][gowebly_url]: A next-generation CLI tool to easily build amazing web applications with Go on the backend, using htmx & hyperscript and the most popular CSS frameworks on the frontend.
- ✨ [Create Go App][cgapp_url]: Create a new production-ready project with Go backend, frontend and deploy automation by running one CLI command.

Other my small projects: [yatr][yatr_url], [gosl][gosl_url], [json2csv][json2csv_url], [csv2api][csv2api_url].

<!-- Footer links -->

[gowebly_url]: https://github.com/gowebly/gowebly
[cgapp_url]: https://github.com/create-go-app
[yatr_url]: https://github.com/koddr/yatr
[gosl_url]: https://github.com/koddr/gosl
[csv2api_url]: https://github.com/koddr/csv2api
[json2csv_url]: https://github.com/koddr/json2csv