An open API service indexing awesome lists of open source software.

https://github.com/lucjosin/astro-rename-example

How to use the astro-rename integration to hash all CSS class names from your astro project
https://github.com/lucjosin/astro-rename-example

astro css integration postcss

Last synced: about 2 months ago
JSON representation

How to use the astro-rename integration to hash all CSS class names from your astro project

Awesome Lists containing this project

README

          

# Example of astro-rename integration

Final project of blog post: [How to hash class names in astro using astro-rename integration](https://lucjos.in/b/pNCgOiQi)

| Before | After |
| :------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| ![Devtools default](https://raw.githubusercontent.com/lucjosin/lucasjosino.com/main/public/static/blog/pNCgOiQi/devtools-from-default-astro-project.png) | ![Devtools after](https://raw.githubusercontent.com/lucjosin/lucasjosino.com/main/public/static/blog/pNCgOiQi/devtools-from-custom-astro-rename-strategy.png) |

![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)

## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:

```text
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
```

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |