Live data from Hacker News

Astro 1.0 – a web framework for building fast, content-focused websites

astro.build

221–230 of 256 posts

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#221

TBH if it comes with some decent starter templates it's a massives step up from what the python world offers. I've been looking to make a simple website recently - landing page, user sign up, taking payments, then access to a simple react one-pager. It's all doable but with django you just have to do everything, even if you start with the cookicutter. I just want something where I can pick from a good base template,…

Django-tailwind + flowbite blocks

Thanks, those blocks are exactly what I'm looking for.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#222
post #214

I used Astro recently to rebuild my personal website/portfolio, and I really enjoyed it. I'm not a frontend dev and I quickly get overwhelmed by all of the choices and the breakneck speed that the web ecosystem changes at. Astro was exactly what I needed. It's optimized for spending most of your time writing content in markdown, but it gives you complete freedom to seamlessly add web code of any complexity you like.…

I looked at your site and its source code. The site is snappy and code straightforward. I would love to tinker with Astro when time allows.

Is this it? https://nathangarfield.com/blog/what-sailing-taught-me-about...

> it’s nearly impossible to sail on your own

Just have to comment that this is plain false (as already evident by dinghy sailing). I've sailed up to 35-footers solo (although I'd advise to stay below 30-ish or 3-4 tons, makes it easier to not crash hard into things). It takes a bit more prepping and does help a lot if you have an autopilot or windvane self-steering (for sail changes and reefing) but it can be done without as well.

And I used to sail my 28-footer solo without an engine.

If you're interested in sailing I recommend checking out Per Tangvald (known as Peter Tangvald). He sailed around the world in his homebuilt engineless ~52-footer for decades, generally handling the boat by himself.

https://wavetrain.net/2016/01/17/sea-gypsy-early-adventures-...

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#223

Earlier quoted context omitted.

I like using Nim or Rust, or TypeScript, depends on the script. If it's just a few lines, sure I'll write it in bash, but if it gets a little larger, I convert it into a real programming language.

But TypeScript doesn’t have ADTs which you stated was a hard requirement. It has some other features that can achieve similar things though, so maybe that’s good enough?

Kinda nitpicky. Sure ADTs are a pattern in Typescript rather than a first-class entity, but they're an extremely well-supported pattern, exhaustiveness checking and all.

    type ADT = 
        | { case : 'a', a : Number }
        | { case : 'b', b : string }

    function f (c : ADT) {
        switch(c.case) {
            case 'a' : return c.a
            case 'b' : return Number.parseInt(c.b)

            // case 'c' : return 0 // compile error

            // case 'b' : return c.a // also compile error
        }
    }

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#224

Earlier quoted context omitted.

Developer experience writing React is much nicer than using other markup languages. That's why I use it at least, the fact that it spits out a fully JS-free website at the end is the icing on the top.

Nothing about the developer experience of React seems better than any old HTML template language (and hardly better even than plain HTML), if you're not doing any interactivity and are just going to render once and spit out the HTML.

> Nothing about the developer experience of React seems better than any old HTML template language

Is that a joke? You get autocomplete from typescript and props to be fully typed functions, or any kind of object for that matter. That compares to autocomplete that's just some ad-hoc, bug ridden tools that locks you into some IDE or editor, and who cares because all the attributes have the same type (string) anyway.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#225

Earlier quoted context omitted.

Have you used React before? It's miles above HTML templating. I honestly don't use frameworks that have regular templating anymore, like Vue or Svelte.

I have used React. I'm a huge fan and I also prefer it over its most common "competitors" like Vue and Svelte. But React (like Vue and Svelte) are fundamentally about interactivity. If I had a project where I knew for sure that I only wanted to generate HTML sans JS on the server (or with a static build process) I wouldn't even consider using React. It barely even makes sense. Your "React components" would just be Ja…

JSX is much easier to maintain than pretty much every other templating language.

If you are building a growing design system with any degree of complexity, React is one of the best tools available.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#226

Earlier quoted context omitted.

Component-based UI frameworks and ecosystem has made building frontends much nicer, especially when you need some optional interactivity since you're already writing in JS. Having that productivity and flexibility without the SPA complexity and other JS cruft has real value.

In that case, it'd be interesting to see the benefits of Astro vs something like Gatsby

Frameworks like Gatsby didnt have any special support for interactive islands. You can choose to have:

a. A completely static site with no frontend javascript and no client side hydration, or

b. client hydration in which case all the components needed in the page will need to be loaded in the client.

If you want something in between, ie. only some sections need to be interactive, it requires jumping through some hoops eg. creating separate webpack entrypoints that call ReactDOM.render for specific DOM nodes. It is doable but more work and maintenance effort.

Astro simplifies handling for these kind of islands by using a server side templating language that is component aware and familiar to users already writing jsx.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#227

Earlier quoted context omitted.

I like using Nim or Rust, or TypeScript, depends on the script. If it's just a few lines, sure I'll write it in bash, but if it gets a little larger, I convert it into a real programming language.

Rust as a replacement for a bash script? My bash scripts are often edited, I could not imagine using a compiled language where I would have to store the source as a separate file from the executable, then compile it each time. I'd love to know your more specific use cases, if you don't mind. I'm always happy to learn something new. Could you share some Rust that most people would script in Bash as an example? What's…

> where I would have to store the source as a separate file from the executable, then compile it each time

> What's your build and deploy (to ~/.local/bin I presume) strategy?

You can run scripts as you would with bash, you don't have to manually build and run the executable. For example, `cargo run (inside the script source folder)` and `sh script.sh` do basically the same thing, end user wise. `nim compile --run script.nim` is similar in that the language compiler will automatically compile and run it together.

> Could you share some Rust that most people would script in Bash as an example?

I was creating dotfiles the other day and I didn't want to use some dotfile manager program as I had some specific steps I wanted to follow, so I started it as a bash script. Well, it got kind of annoying so I made it into a Rust script with some nice features like interactive prompts, text coloring, etc with libraries like `clap`. You can do this in bash of course, but the Rust version was more ergonomic. When I need to run the script, I just did `cargo run` and it worked great.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#228

Earlier quoted context omitted.

Developer experience writing React is much nicer than using other markup languages. That's why I use it at least, the fact that it spits out a fully JS-free website at the end is the icing on the top.

and what's your experience writing other markup languages that you base this statement on? I can definitely agree it is nicer for a data intensive sites, and with effort can be made somewhat equivalent in most document heavy sites, but there are definitely some scenarios I've encountered where the match of technology to use case was disastrously not in React's favor. Specifically I can think of parts of the websites'…

I've used many, Handlebars, Pug, Vue's, Svelte's, Zola's, many. They're all somewhat similar in that they try to recreate loops and conditionals, all without strong type support unlike in JSX. I've never used SGML though, another commenter told me that it is more powerful.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#229

Earlier quoted context omitted.

Rust as a replacement for a bash script? My bash scripts are often edited, I could not imagine using a compiled language where I would have to store the source as a separate file from the executable, then compile it each time. I'd love to know your more specific use cases, if you don't mind. I'm always happy to learn something new. Could you share some Rust that most people would script in Bash as an example? What's…

> where I would have to store the source as a separate file from the executable, then compile it each time > What's your build and deploy (to ~/.local/bin I presume) strategy? You can run scripts as you would with bash, you don't have to manually build and run the executable. For example, `cargo run (inside the script source folder)` and `sh script.sh` do basically the same thing, end user wise. `nim compile --run sc…

I see, but then your scripts are not nice compact commands.

For instance, my most-used bash script takes a file as input and opens either VIM or Emacs depending on whether the file is a .md or .org (simplified example). I run it like so:

  $ n foo.org
I can edit ~/.local/bin/n and update the file, and use it immediately. I actually have my whole ~/.local/bin in version control. Having to type out e.g.

  $ nim compile --run n foo.org
...would make the whole experience far less fluent. I probably would never use it.

I'm asking because I'd love to rewrite this script in e.g. Rust, but I don't see any good way to deploy it to ~/.local/bin/n.

Re: Astro 1.0 – a web framework for building fast, content-focused websites

#230
post #89

I'm looking at https://docs.astro.build/en/concepts/why-astro/ and I still can't tell what's interesting and unique about this as compared to other options in this space. I acknowledge that this might be a PEBKAC situation, but I'd love to hear thoughts from people who used Next.js, Remix, or whatever and found Astro to be a revelation. It seems like Astro's creators believe "content-focused" is a differentiator, but…

While Astro has a lot of impressive features I found that it was the "developer experience" (god I hate that term) that was superior compared to everything I've tried before. With Hugo and Jekyll I always needed to go revisit the docs whenever I hadn't worked with it for a while. I never got to the "oh, I get this tool now" phase, where the content generation could just flow without issues. Publii was cool, but tryin…

Have you used Next.js much? Next was the first (and so far, only) SSG I enjoyed using in the JS world. Just wondering if you have any comparisons. Markdown generation in Next was also a breeze.
Post reply on HN