Landing Page in 10 Minutes with Astro and CodeStitch

Cedar Studios Web Design
17 Oct 202309:44

Summary

TLDREn este video, Ryan de Cedar Studios Web Design nos guía a través del proceso de construcción rápida de una página de aterrizaje utilizando Astro, un marco web veloz y potente, junto con Code Stitch, una biblioteca de componentes de HTML y CSS. Comenzando con la creación de un nuevo proyecto en Astro, Ryan explica cómo instalar dependencias, configurar TypeScript y estructurar el sitio web usando componentes y estilos proporcionados por Code Stitch. El tutorial abarca desde la implementación de una barra de navegación y un componente hero hasta la adición de otros elementos esenciales de la página, demostrando lo sencillo y rápido que es construir una página de aterrizaje atractiva y funcional para pequeñas empresas.

Takeaways

  • 🛠️ El script proporciona una guía detallada sobre cómo construir una página de aterrizaje utilizando Astro, un framework web rápido y potente, y Code Stitch, una biblioteca de componentes de HTML y CSS para pequeñas empresas.
  • 🚀 Astro utiliza un enfoque basado en componentes, lo que facilita la creación de sitios web como bloques de Lego, copiando y pegando componentes de Code Stitch.
  • 📁 Astro organiza las páginas web en la carpeta 'Pages', enrutando automáticamente cada archivo como una página individual.
  • ⚙️ Los archivos .astro admiten 'front matter' para ejecutar código JavaScript antes de construir el sitio estático o realizar el renderizado del lado del servidor.
  • 📄 Los estilos CSS se pueden incluir en etiquetas <style> dentro de los componentes, y se aplicarán de forma aislada a ese componente específico.
  • 🔄 Astro permite importar componentes fácilmente usando la sintaxis de importación de ES6.
  • 🌐 Los componentes de Code Stitch son responsivos y optimizados para dispositivos móviles de forma predeterminada.
  • 💻 El script demuestra la creación rápida de una página de aterrizaje completa combinando componentes de Astro y Code Stitch.
  • 📖 Se mencionan futuras lecciones sobre el uso de la sintaxis JSX dentro de los archivos Astro y la creación de layouts.
  • ⏱️ El enfoque de Astro y Code Stitch permite construir sitios web de forma rápida y eficiente, especialmente para pequeñas empresas que buscan una solución sencilla y efectiva.

Q & A

  • ¿Qué es Astro y por qué se recomienda utilizarlo?

    -Astro es un marco web rápido y potente. Se recomienda utilizarlo porque facilita la creación de sitios web de forma rápida y eficiente, especialmente sitios de aterrizaje (landing pages).

  • ¿Qué es codeStitch y por qué se utiliza junto con Astro?

    -codeStitch es una biblioteca de componentes de HTML y CSS puros, diseñada específicamente para pequeñas empresas. Se utiliza junto con Astro porque ofrece componentes responsivos y atractivos que se pueden integrar fácilmente en los proyectos de Astro.

  • ¿Cuál es el propósito de la carpeta 'páginas' en un proyecto de Astro?

    -La carpeta 'páginas' (pages) en un proyecto de Astro contiene cada una de las páginas web individuales que componen el sitio web. Astro enruta automáticamente estas páginas.

  • Explique la funcionalidad del 'front matter' en los archivos de Astro.

    -El 'front matter' es una sección YAML al inicio de los archivos de Astro que permite ejecutar código JavaScript antes de construir el sitio estático o renderizarlo en el servidor. Es útil para importar datos, componentes y realizar operaciones previas.

  • ¿Qué ventajas ofrece el enfoque basado en componentes al desarrollar con Astro y codeStitch?

    -El enfoque basado en componentes facilita el desarrollo modular, reutilizando componentes y ensamblándolos como bloques de construcción. Esto agiliza el proceso de creación de sitios web, aprovechando los componentes prediseñados de codeStitch.

  • ¿Cómo se pueden aplicar estilos CSS a los componentes en Astro?

    -En Astro, se pueden aplicar estilos CSS directamente en los componentes utilizando etiquetas <style>. Los estilos CSS incluidos en un componente estarán automáticamente limitados en su alcance a ese componente.

  • ¿Qué papel juega el archivo 'index.astro' en un proyecto de Astro?

    -El archivo 'index.astro' es el punto de entrada principal de un proyecto de Astro. Representa la página de inicio del sitio web y es donde se ensamblan los componentes para construir la estructura completa del sitio.

  • ¿Cómo se importan y utilizan componentes en los archivos de Astro?

    -Los componentes se importan en los archivos de Astro utilizando la sintaxis de importación de ES6. Una vez importados, se pueden utilizar como etiquetas personalizadas en el marcado HTML del archivo.

  • ¿Qué son las 'core styles' en codeStitch y cómo se integran en un proyecto de Astro?

    -Las 'core styles' en codeStitch son estilos CSS globales que definen colores, fuentes y otros estilos base para toda la aplicación. Se pueden integrar en un proyecto de Astro incluyéndolos en un archivo de estilos global o directamente en el archivo 'index.astro'.

  • ¿Qué otros temas se mencionan que se cubrirán en un video futuro relacionado con Astro?

    -Se mencionan los siguientes temas que se cubrirán en un video futuro: usar la sintaxis JSX dentro de los archivos de Astro, trabajar con diseños (layouts) en Astro y construir múltiples páginas.

Outlines

00:00

🏗️ Creando un proyecto Astro desde cero

El párrafo describe cómo crear un nuevo proyecto Astro desde la terminal utilizando el comando 'npm create astro@latest'. Explica el proceso de instalación, configuración y lanzamiento del servidor de desarrollo. También menciona que se utilizará Typescript para el desarrollo y se proporcionará un breve resumen de cómo Astro maneja el enrutamiento de páginas a través de la carpeta 'pages'. Además, introduce el concepto de 'front matter' en los archivos Astro, que permite ejecutar JavaScript antes de la construcción del sitio.

05:00

🚀 Integrando componentes CodeStitch en Astro

Este párrafo explica cómo integrar componentes de CodeStitch en un proyecto Astro. Comienza copiando el HTML, CSS y JavaScript de un componente de navegación desde CodeStitch. Luego, crea un nuevo componente 'Navbar' en Astro y pega el código copiado. A continuación, importa y renderiza el componente 'Navbar' en la página principal. Después, repite el proceso para un componente de 'Hero' y otros componentes adicionales. Finalmente, muestra el resultado final de una página de destino completa creada rápidamente utilizando Astro y CodeStitch.

Mindmap

Keywords

💡Astro

Astro es un marco de trabajo web mencionado en el guión. Se describe como una herramienta rápida y poderosa para crear sitios web. Astro se utiliza en este video para construir una página de aterrizaje de manera rápida y eficiente, combinándolo con la biblioteca de componentes CodeStitch. Por ejemplo, se muestra cómo crear un nuevo proyecto de Astro y comenzar a agregar componentes HTML y CSS rápidamente.

💡CodeStitch

CodeStitch es una biblioteca de componentes de HTML y CSS mencionada en el guión. Se describe como una colección de componentes web responsivos y específicamente diseñados para pequeñas empresas. En el video, se utiliza CodeStitch para obtener los códigos HTML, CSS y JavaScript necesarios para construir componentes como la barra de navegación, el héroe y otros elementos de la página de aterrizaje, acelerando así el proceso de desarrollo.

💡Componentes

Los componentes son elementos reutilizables de una interfaz de usuario que se pueden combinar para construir una aplicación o sitio web. En el contexto del video, se hace referencia a los componentes como bloques de construcción para ensamblar rápidamente una página de aterrizaje. Se muestran ejemplos de cómo crear archivos separados para componentes como la barra de navegación, el héroe, las secciones de precios y comentarios, y el pie de página, importándolos luego al archivo principal de Astro.

💡HTML

HTML (Lenguaje de Marcado de Hipertexto) es el lenguaje estándar para crear y estructurar el contenido de las páginas web. En el video, se muestra cómo copiar y pegar el código HTML de los componentes de CodeStitch directamente en los archivos de componentes de Astro, lo que facilita la creación rápida de la estructura básica de la página de aterrizaje.

💡CSS

CSS (Hojas de Estilo en Cascada) es un lenguaje de diseño utilizado para controlar la presentación y el estilo visual de los elementos en una página web. En el video, se destaca cómo Astro permite incluir el CSS dentro de las etiquetas de estilo en los archivos de componentes, lo que mantiene el estilo encapsulado y específico para cada componente. Además, se muestra cómo importar estilos globales de CodeStitch para mantener una apariencia coherente en todo el sitio.

💡JavaScript

JavaScript es un lenguaje de programación utilizado principalmente para agregar interactividad y comportamiento dinámico a las páginas web. En el video, se muestra cómo Astro permite incrustar JavaScript dentro de las etiquetas de script en los archivos de componentes. Esto se ilustra al agregar la funcionalidad del menú desplegable para la barra de navegación en dispositivos móviles, copiando el código JavaScript proporcionado por CodeStitch.

💡Front Matter

Front Matter se refiere a la sección inicial en los archivos de Astro, delimitada por tres guiones, donde se puede ejecutar código JavaScript antes de procesar el contenido del archivo. En el video, se muestra cómo utilizar el Front Matter para importar componentes y variables que se utilizarán en la página. Por ejemplo, se importa el componente de la barra de navegación y se declara una variable de suma para demostrar cómo se puede ejecutar código JavaScript en esta sección.

💡Responsivo

Responsivo, o diseño web responsivo, se refiere a la capacidad de un sitio web para adaptarse y verse bien en diferentes tamaños de pantalla y dispositivos, como computadoras de escritorio, tabletas y teléfonos móviles. En el video, se enfatiza que los componentes de CodeStitch son responsivos de forma predeterminada, lo que facilita la creación de una página de aterrizaje que se vea bien en dispositivos de diferentes tamaños sin esfuerzo adicional.

💡Barra de navegación

Una barra de navegación es un elemento común en los sitios web que proporciona enlaces a diferentes secciones o páginas del sitio. En el video, se muestra cómo construir una barra de navegación responsiva utilizando un componente de CodeStitch, que incluye un menú desplegable para dispositivos móviles. Se enfatiza la facilidad de copiar y pegar el código HTML, CSS y JavaScript necesario para este componente en el archivo de componente de Astro correspondiente.

💡Héroe

Un héroe, o sección de héroe, es un elemento común en las páginas de aterrizaje que ocupa una gran parte de la pantalla y generalmente contiene un encabezado atractivo, una breve descripción y posiblemente un botón de llamada a la acción. En el video, se demuestra cómo agregar un componente de héroe desde CodeStitch a la página de aterrizaje, copiando y pegando el código HTML y CSS correspondiente en el archivo de componente de Astro.

Highlights

Astro is a web framework that's very fast and powerful, and codeStitch is a component library with pure HTML and CSS components that are responsive and designed for small businesses.

Creating a new Astro project with the latest version using 'npm create astro@latest'.

Astro files have a YAML-style front matter where you can execute JavaScript code before building the static site or server-side rendering.

Demonstrating how to import and use a navigation bar component from codeStitch, including HTML, CSS, and JavaScript.

Showing how Astro styles are scoped by default to the component file, and how to include global styles.

Importing and using a hero component from codeStitch, including HTML and CSS.

Building multiple components by copying and pasting from codeStitch, including side-by-side sections, team section, pricing, reviews, call-to-action, and footer.

Mentioning future plans to demonstrate using JSX syntax within Astro files for fetching data from a CMS, and discussing layouts and building more pages.

Demonstrating the ease and speed of building a landing page using Astro and codeStitch.

Transcripts

play00:00

hi this is Ryan with cedar Studios web

play00:02

design today we're going to build a

play00:04

landing page very quickly using Astro

play00:07

which is one of our favorite tools it's

play00:08

a web framework that's very fast and

play00:10

very powerful and code Stitch which is a

play00:15

component library with pure HTML and CSS

play00:17

components that're very nice they're

play00:19

responsive and they're specifically

play00:20

designed for small businesses so the

play00:23

first thing we're going to do is build a

play00:24

new project I'll copy this here head

play00:26

into my developer

play00:28

folder paste that and PM create Astro at

play00:32

latest that will create an astro project

play00:34

of the latest version it's going to

play00:35

launch this installer it's going to ask

play00:37

for Nam so we'll call it Astro dcode

play00:41

Stitch we'll just build an empty project

play00:44

for now and we'll hit install

play00:47

dependencies this will take a minute to

play00:49

run while it does I just want to explain

play00:51

that this is not going to be a very

play00:53

in-depth Astro or code Stitch tutorial

play00:56

there's some good videos for that I'll

play00:58

link a couple below this but I'm just

play01:00

going to show you a proof of concept of

play01:02

how fast you can build a site using

play01:04

these

play01:05

tools so once this gets done running

play01:08

it's going to ask us if we want to use

play01:10

typescript in our project any second now

play01:14

there it goes I'll say yes we're not

play01:16

going to use any today but that's

play01:18

primarily what I use for development and

play01:20

then I'm going to skip adding a git

play01:23

repository so this is all created now

play01:26

I'm going

play01:27

to go into this project and then I'm

play01:30

going to

play01:31

launch so this has built a project for

play01:35

us it's pretty Bare Bones right now with

play01:38

a few files in here but the most

play01:40

important that we're going to be paying

play01:41

attention to today is the source folder

play01:43

which has all the code we need to build

play01:45

a website and then there's this special

play01:47

folder inside called Pages which is

play01:50

going to contain each individual web

play01:51

page that we're using and Astro is going

play01:53

to Route these Pages automatically it's

play01:55

already built for us an index page it

play01:57

looks like this you can see some HTML

play01:59

boiler plate there's just an H1 here

play02:01

that says Astro so this should be pretty

play02:03

Bare Bones so we'll just do npm start

play02:06

which will launch a Dev server for

play02:08

us go to this URL and yep you can see

play02:11

the H1 right here another feature of

play02:14

Astro files which are basically just

play02:16

HTML files with a little extra is that

play02:20

they have this yaml style front matter

play02:23

in which you can execute JavaScript code

play02:26

as that's run before you build a static

play02:28

site or that's run on the server if you

play02:30

have serers side rendering so for

play02:32

instance I could create a variable

play02:35

called sum it'll just equal 1 plus

play02:40

two and then down here I could open up

play02:42

an H2 Tag and Call sum and here you go

play02:46

we have three so again this isn't client

play02:49

side JavaScript that's going to run on

play02:51

the website if we wanted that we could

play02:52

just add a script tag right here and add

play02:54

some

play02:55

JavaScript but this is going to be run

play02:58

uh as you build a website so this is

play02:59

great great for pulling in data pulling

play03:01

in components um anything you

play03:04

need so the first thing we want to do is

play03:07

let's go ahead and strip this stuff out

play03:09

we just have blank website now well

play03:11

we're going to want to go to code Stitch

play03:13

and first find a nav bar I'm just on a

play03:16

free account today so you can see what's

play03:17

available to you before you sign up so

play03:19

these are locked but we have a couple

play03:20

options right here there one with a

play03:22

drop- down and then there's just kind of

play03:23

like a standard one so let's go to this

play03:25

we'll hit get

play03:27

code and we'll see all the files I need

play03:29

to build a really nice nav bar that's

play03:31

responsive and mobile friendly so we

play03:33

have HTML and that's going to place all

play03:36

of the uh components on or all the

play03:40

elements on the website we've got CSS

play03:43

which is going to style those elements

play03:45

we have one called core Styles I should

play03:46

put this somewhere in my project and

play03:48

it'll just give me access to things like

play03:51

colors like primary colors that's going

play03:53

to apply throughout the entire website

play03:55

and then for this particular component

play03:57

there's going to be some JavaScript

play03:58

because it's going to make a little

play04:00

hamburger button on the mobile menu that

play04:04

you click to open and close it so I'm

play04:06

going to go ahead and copy this HTML and

play04:09

come in here to my index. asro file now

play04:11

I could just start pasting it here in

play04:13

the body or we could take a more

play04:15

component-based approach to developing

play04:17

this in which I would add a new folder

play04:20

in Source called

play04:22

components and a new file I'll call it

play04:25

navb bar. asro and in here I'll paste

play04:29

that

play04:30

HTML if I come back here I can again use

play04:33

this front matter to run JavaScript so

play04:35

I'm going to

play04:36

import the

play04:38

navbar

play04:40

from components folder navb bar.

play04:46

Astro and that's going to import this

play04:48

thing at build time so it's not going to

play04:50

slow down my website at all to import

play04:52

this and these Astro files even though

play04:54

it's just HTML it's going to export

play04:56

itself as a component for me to use like

play04:58

this automatically

play05:00

so here in the body I can open a new tag

play05:03

and close it off just like a jsx react

play05:06

kind of component and hit save and now

play05:11

if I come in here I see my whole nav bar

play05:13

it's not styled yet CU we haven't added

play05:15

that in but you can tell that just by

play05:20

building out components in their own

play05:21

files copy pasting them from code Stitch

play05:23

that was super easy I can start just

play05:25

building these things like Lego blocks I

play05:27

could have a hero comp comp next

play05:31

Etc so let's go ahead and finish this

play05:34

one out and then we'll start with a hero

play05:35

component so we need the Styles next I'm

play05:38

going to close these out for

play05:40

now and go to our CSS I'll copy and now

play05:44

what I could do is I could add a new

play05:47

file that's index.css and split it up

play05:49

like that or I can go into my nav bar I

play05:53

can open up a style tag and put it all

play05:56

there and what's great about Astro is

play05:59

that these styles are going to be scoped

play06:02

by default to Navar this folder or this

play06:05

file

play06:07

rather and so in here I'm going to go

play06:09

ahead and comment this out for now if I

play06:12

hit save I have a styled Navar some

play06:15

things are going to be a little off

play06:17

right there's this contact us button

play06:19

that seems to be invisible the reason

play06:21

that is is because I haven't copied

play06:22

these core Styles yet that's a code

play06:24

Stitch thing so I'm going to go ahead

play06:25

and copy this and again it says put it

play06:28

in a global style sheet

play06:30

I could make a global style sheet in

play06:31

here or I could just go into my index

play06:33

file and do the same thing just do a

play06:36

style tag put it in there and save it

play06:40

come back here and look now everything's

play06:42

styled it has this nice orange color

play06:45

that's going to apply throughout the

play06:46

website the fonts a little off it's the

play06:48

Sarah fonts and I don't think that's set

play06:50

in here so I'm just going to go ahead

play06:51

and do just a very simple font family

play06:57

system that'll give me this nice sansera

play07:00

font okay so it was that easy to build a

play07:04

Navar component and style it and bring

play07:08

it into my website now you will notice

play07:11

this looks great on desktop or mobile

play07:15

but this hamburger button isn't working

play07:17

and that's cuz I haven't just copied

play07:18

this jss anymore or yet so I can go back

play07:21

to my nabar and I can just simply do a

play07:23

script tag paste it in there types

play07:26

script's going to yell at me a little

play07:27

bit because I have that configured for

play07:28

the project but I come in here and now

play07:31

it's

play07:33

working this script tag is also going to

play07:36

be scoped to the Navar

play07:38

file so let's go

play07:40

ahead and let's

play07:43

start in here I'll collapse this let's

play07:45

start building this hero right same

play07:47

thing again we're going to add a new

play07:49

file we're going to call it hero. Astro

play07:53

I already picked one out from code

play07:54

Stitch that I like it's going to be this

play07:57

one going to hit get code there's going

play08:00

to be the HTML which I'm going to copy

play08:02

in now I'll go ahead and do that copy it

play08:04

here paste it save and then there's

play08:07

going to be some CSS so I'll copy that

play08:09

put that in the style

play08:11

tag

play08:12

oops paste it save it and then there's

play08:16

some core styles again I don't need to

play08:17

recopy this because I already have this

play08:20

saved right here so now my heroes about

play08:23

ready to go I'll do command period

play08:25

little VSS code trick to add the import

play08:28

and hit save

play08:30

and there we go now I have a hero that's

play08:32

taking its orange color from my root uh

play08:35

Styles right here and everything's

play08:38

looking great so far so I'm going to

play08:40

skip ahead and add a few more components

play08:42

just copy and pasting from code Stitch

play08:44

and I'll see back here in a second and

play08:46

just show you the full

play08:48

website okay so now you can see in

play08:51

components I've built a lot more

play08:53

components I have pulled them in here in

play08:55

the front matter and then I've put them

play08:57

down here so if I I scroll I see I have

play09:00

a nice side by side a little meet the

play09:02

team section some pricing some reviews a

play09:07

call to action and a footer and that is

play09:10

how easy it is to build a landing page

play09:13

with Astro and code Stitch and in my

play09:17

next video I'll show you some extra fun

play09:19

things like using jsx syntax

play09:23

within the Astro files down here which

play09:26

is great for if you want to pull in data

play09:28

from a cm m s or something like that

play09:30

I'll talk about uh layouts in Astro and

play09:34

build more pages with you but for now I

play09:36

just wanted to show you a little bit

play09:37

about how fast you can build a landing

play09:39

page with Astro and code

play09:43

Stitch

Rate This

5.0 / 5 (0 votes)

Do you need a summary in English?