Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/book/v1/how-tos/bundle-static-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Bundle Static Modules

[Vite](https://vite.dev/) is a frontend dev tool we use:

- To avoid network bottlenecks that can occur when your application has a lot of separate scripts and style sheets.
- To concatenate and compress (uglify) `.css` and `.js` files
- To preprocess `.scss` files into `.css`.
- To copy the `fonts` and `images` used in your project, from the `assets` folder to the `public` folder.

First you need to install dependencies into the `node_modules` directory by running this command:

```shell
npm install
```

If everything ran ok, you should see a new root folder named `node_modules` where all the npm packages are installed.
If `npm install` fails, this could be caused by user permissions for npm.
Our recommendation is to install npm through `Node Version Manager`.

The build command compiles the components then monitors the source files and triggers their recompilation when one of them is changed:

```shell
npm run build
```

Initially, Vite is configured to delete and rebuild the contents of these folders from the `public` folder':

- css
- fonts
- images
- js

The folders are populated from their counterparts in `src/App/assets`.

> Make sure to not edit anything inside the four public folders manually.
> Other folders and the three initial files in the public folder will be left as is.
Comment thread
bidi47 marked this conversation as resolved.
Outdated

To review the project via Vite, you can use this command that starts the PHP server on port 8080:

```shell
npm run preview
```

The above command executes `php -S 0.0.0.0:8080 -t public`, with the added benefit that it refreshes the page whenever a recompilation is completed.
Comment thread
bidi47 marked this conversation as resolved.
Outdated
22 changes: 0 additions & 22 deletions docs/book/v1/how-tos/npm-commands.md

This file was deleted.

2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nav:
- "Running the Application": v1/installation/running-the-application.md
- "FAQ": v1/installation/faq.md
- How to:
- "Use NPM Commands": v1/how-tos/npm-commands.md
- "Bundle Static Modules": v1/how-tos/bundle-static-modules.md
- "Routing": v1/how-tos/routing.md
- "Create Pages": v1/how-tos/create-pages.md
- "Set Up Twitter and OpenGraph Cards": v1/how-tos/twitter-opengraph-cards.md
Expand Down