Live data from Hacker News

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

astro.build

251–256 of 256 posts

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

#251

Earlier quoted context omitted.

Some day we have to stop repeating this nonsense. JSX requires much more learning than simple templating, there is no inherent benefit. Even a simple conditional is more complex than your average template.

The thing is, if you know JS, then a conditional is JSX is the same as in JS. Contrast that with every new templating language under the sun which might have its own way of doing conditionals and loops and control flow. That to me is much more annoying.

This is a dubious claim, since JSX is limited to expressions. If you ask people for “a conditional in JS”, they’ll very probably go for `if (…) { … } else { … }` first, not `… ? … : …` (if you can even rewrite it as a ternary). Same deal with loops: you’re limited to expressions, so you can’t use the normal way of writing a loop (and this regularly leads to mild contortions as you deal with iterables of diverse types). Therefore I’d tend to (qualifiedly) describe JSX as doing its own thing too.

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

#252

Earlier quoted context omitted.

Hey, mind sharing your website? I'd like to check it out.

I've added it to my profile. It's nothing fancy, mind you, but I think it gets the job done.

Cool, thanks. Looks good

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

#253

Earlier quoted context omitted.

Also Astro sites can be hosted on CloudFront or any another static CDN. Next you’re kind of tied to Vercel no?

You can upload the Next.js build to anything you like. netlify, S3 bucket, Apache or Nginx server running on solar powered bare metal. If you need backend api functions - https://github.com/serverless-nextjs/serverless-next.js/ AWS Lambda etc. Probably slightly more work I grant you.

I tried this and the output HTML seemed pretty awful, but perhaps I was doing it wrong.

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

#254
post #20

Earlier quoted context omitted.

It's interesting their blog post doesn't mention some of the benefits. Neither does the doc page you linked—at least it doesn't do it succinctly. Essentially Astro lets you build sites using a JS framework like React or Vue without requiring that framework to be loaded on the frontend. By default, components are just HTML content. Super nice for building very fast static sites using a technology you may already be fl…

Not getting it tbh. Why would you go nuclear and develop a React or Vue app and then not actually use it on the browser side? For content-oriented websites there are much simpler workflows based on SGML and other classic markup processing and content management practices. I mean the point of "content-oriented" and web sites in general really is that an expert in the field, rather than a web developer, can achieve use…

I suppose it's just a different templating engine (plus some optional features for the client side). Probably as a front-end developer people are more familiar with that compared to Jinja for example? Though I think if the target is static web sites then it's simply overkill.

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

#255

Earlier quoted context omitted.

The thing is, if you know JS, then a conditional is JSX is the same as in JS. Contrast that with every new templating language under the sun which might have its own way of doing conditionals and loops and control flow. That to me is much more annoying.

This is a dubious claim, since JSX is limited to expressions . If you ask people for “a conditional in JS”, they’ll very probably go for `if (…) { … } else { … }` first, not `… ? … : …` (if you can even rewrite it as a ternary). Same deal with loops: you’re limited to expressions, so you can’t use the normal way of writing a loop (and this regularly leads to mild contortions as you deal with iterables of diverse type…

Plenty of people are taught that ternary operators are evil and should never be used.

Plenty of people were also taught that proper architecture involved an AbstractGetterVisitorFactoryFactory.

That doesn't make either of those things true.

As a side note, if you find yourself wanting a loop but using `map` isn't sufficient, you should probably be preparing the values ahead of time and still using map. It'll be more efficient, and the code easier to read.

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

#256

Earlier quoted context omitted.

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 --r…

For nim, you could use something like nimcr ( https://nimble.directory/pkg/nimcr ). You put a shebang in your script `#!/usr/bin/env nimcr` and then call it like a normal script. eg: $ code script.nim #!/usr/bin/env nimcr echo "hello world" $ ./script.nim hello world edit: There's also the possibility of using nimscript, using nim e. It works similarly but you'd change the shebang line to something like #!/usr/bin/en…

Actually another way to do nimscript is to make a config.nims file with tasks in it. eg:

In config.nims:

  switch("hints", "off")
  task hello, "say hello world":
    echo "hello world"
In bash:

  $ nim hello
  hello world
Post reply on HN