Contenido del Curso
Introducción a la Computación en la Nube
Introducción a la Computación en la Nube
Almacenamiento de Fragmentos de Código en AWS S3
In the previous chapter, we wrote HTML code that allows us to feed the turtle, and in this code, we used an image that we uploaded to AWS S3 in a public bucket. But you may have noticed that reading the code from there was quite inconvenient due to the large number of styles.
I'm leading up to the fact that we can also upload certain code snippets to AWS S3, just like images. For example, in our case, it would be convenient to upload CSS styles for our HTML pages or applications to AWS in order to save space in the code.
Let's take a look at the style file I want to upload to the storage:
index.css
To add a file with styles to AWS S3, we first need to create the file and upload it to our public bucket:
To apply these CSS styles in your HTML code, you just need to use a straightforward syntax:
En el caso de enlazar nuestros estilos, esta línea se verá así:
Veamos cuánto se reducirá nuestro código después de nuestros cambios y cómo se verá ahora:
index.html
If you click and follow this link, you'll see the contents of this file, specifically the styles I wrote earlier. This way, both we and the visitors to our website can view the styles stored on AWS and may want to borrow them from us.
script.js
Now, we need to use the following syntax to add the script to the code via the link:
Después de agregar el script desde AWS S3, nuestro código para la tortuga se verá así:
Nota
Por cierto, puedes ver nuevamente el script directamente a través del enlace.
index.html
¡Gracias por tus comentarios!