Live data from Hacker News

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

astro.build

241–250 of 256 posts

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

#241
post #222
post #214

Earlier quoted context omitted.

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…

No, my site is nateglenn.com. I know nothing about sailing XD. Thanks for caring enough to share the info with me, though :)

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

#242

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

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.

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

#243
post #99

Earlier quoted context omitted.

If you don't have npm installed, just stay as far as you can from this :D Seriously, JS static website generators are the worst... use something written in any compiled language so you just download and run a single binary, no messing around with npm and millions of dependencies. Take your pick here: https://jamstack.org/generators/

PHP is pretty great. No NPM needed

PECL? PEAR? Composer? ...

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

#244
post #209

Earlier quoted context omitted.

But you’re aware JSX is just plain old PHP files, code intermingled with HTML? It’s the exact same thing, and it breeds the exact same bad behaviour.

Separation of concerns is different from separation of languages. PHP intermingled with HTML was bad because developers would do things like run database queries and other operations that caused side effects directly in the markup. Every templating system still has logic in it, and almost every templating system as a way to create custom helpers which are written in the host language. Since API calls and calls to rea…

JSX doesn't separate languages, you're mixing HTML with TypeScript. You can absolutely do database queries in your template. What is keeping you from doing `fetch('https://side-effect.ts').then(() => doSomethingHorrible())` in your template? Or invoking an `alert()`?

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

#246
post #244

Earlier quoted context omitted.

Separation of concerns is different from separation of languages. PHP intermingled with HTML was bad because developers would do things like run database queries and other operations that caused side effects directly in the markup. Every templating system still has logic in it, and almost every templating system as a way to create custom helpers which are written in the host language. Since API calls and calls to rea…

JSX doesn't separate languages, you're mixing HTML with TypeScript. You can absolutely do database queries in your template. What is keeping you from doing `fetch(' https://side-effect.ts').then (() => doSomethingHorrible())` in your template? Or invoking an `alert()`?

You can do those things, but you're not going to capture the effect that you want. Renders happen frequently, and the render process will complete before your `fetch` resolves. As for alert, the alert will pop up immediately before the render is applied to the DOM- and will likely pop up many times more than you thought it would, assuming you're popping it up based on some state variable.

In short, you can do those things maliciously, but if you do them naively it is immediately obvious when you run the code that it's not correct.

Compare that to the original analogy to mixing raw PHP and HTML templates. Since the rendering process is blocking, you can easily stuff form handling, remote API calls, and database calls in amongst your markup, and can make it "work" even if it's not clean.

Even Laravel's blade components let you write custom components and helpers in PHP which can do all of those things from the template- you just don't see the actual SQL mixed with the HTML in the same file. The problem is still there, just now it is harder to see.

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

#247

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…

Just alias the command in your .bashrc? e.g. `alias n="nim compile --run n"`. I'm not sure what the issue is with longer commands because the benefits of writing in a strongly statically typed language definitely outweigh a few extra characters to type, which you don't even need to do with aliases.

For what it's worth, you need only type "nim r n". If "n.nim" is marked executable and begins with "#!/usr/bin/nim r" then you also need only type "n.nim".

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

#248

Earlier quoted context omitted.

> 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 --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/env nim e --hints:off

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

#249
post #243

Earlier quoted context omitted.

PHP is pretty great. No NPM needed

PECL? PEAR? Composer? ...

Exactly. PHP (like every other modern programming language) has its own dependency management tools. Node is actually better than many in this respect because npm comes bundled with Node — it's not something you have to install separately.

Ironically, Composer actually lists npm as one of its inspirations [1].

> "...Composer is strongly inspired by node's npm and ruby's bundler."

[1] https://getcomposer.org/doc/00-intro.md

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

#250
post #71

I've used Astro my company's landing page for the past year or so [0]. We write blog posts in Notion and port them right to the site and the experience has been fantastic. There are a few understanding quirks with regard to using React etc within Astro (it's SSR'd unless you add the "client" attribute, and counter-intuitively the Component Lifecycle doesn't run the same). For client landing pages, we'll use Astro too…

Interesting, how does the process of going from Notion to Astro work? Are you just exporting Markdown files, or is there an API integration in use?

Sorry for the late reply- we use the API! We had done so manually for a long time
Post reply on HN