Skip to content

Commit

Permalink
tec: Replace Parcel by esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Oct 31, 2024
1 parent f14335a commit 5a98887
Show file tree
Hide file tree
Showing 15 changed files with 459 additions and 2,980 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.env
/vendor
/node_modules
/.parcel-cache
/.phpunit.result.cache
/coverage

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ It’s also based on other projects:

- [ClearURLs rules](https://clearurls.xyz/) to detect and remove trackers from
URLs;
- [esbuild](https://esbuild.github.io/), a build tool for JavaScript;
- [FakerPHP](https://fakerphp.github.io/) to generate fake data during tests;
- [Minz](https://github.com/flusio/Minz), a small and personal PHP framework;
- [Parcel](https://parceljs.org/), a build tool for JavaScript;
- [Parsedown](https://parsedown.org/) to render Markdown;
- [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer),
[Eslint](https://eslint.org/) and [Stylelint](https://stylelint.io/) to
Expand Down
12 changes: 5 additions & 7 deletions docs/assets.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# How are the assets bundled

I use [Parcel](https://parceljs.org/) to bundle the assets. Be aware I use the
version 2 which is still in beta version. I really like Parcel, but
unfortunately version 1 is buggy with the setup I want…
I use [esbuild](https://esbuild.github.io/) to bundle the assets.

Either if you started Parcel via Docker Compose or NPM, it will look at two
Either if you started esbuild via Docker Compose or NPM, it will look at two
files: [`src/assets/stylesheets/application.css`](/src/assets/stylesheets/application.css)
and [`src/assets/javascripts/application.js`](/src/assets/javascripts/application.js).
These files are the entrypoints and load the other CSS and JS files, which are
monitored by Parcel.
monitored by esbuild.

Each time Parcel detects a change in one of these files, it bundles the files
altogether and puts the bundled files under the `public/dev_assets/` folder.
Each time esbuild detects a change in one of these files, it bundles the files
all together and puts the bundled files under the `public/dev_assets/` folder.
The files are finally loaded in the application [by the layout](/src/views/_layouts/base.phtml)
via the `url_asset()` function.

Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Then start the job worker in a different console:
$ php cli jobs watch
```

And Parcel in another console:
And esbuild in another console:

```console
$ npm run watch
Expand Down
4 changes: 2 additions & 2 deletions docs/technical_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The asynchronous jobs, such as emails sending, are handled by a PHP script. The
worker should be configured as a OS service (e.g. systemd service), or can be
handled via a CRON task (but with less efficiency).

The assets (CSS and JS) are bundled with [Parcel](https://parceljs.org/). The
The assets (CSS and JS) are bundled with [esbuild](https://esbuild.github.io/). The
JavaScript relies on both [Stimulus](https://stimulus.hotwired.dev/) (“a modest
JavaScript framework”) and [Turbo](https://turbo.hotwired.dev/) (used to speed
up navigation on the application). The dependencies are managed with
Expand All @@ -34,5 +34,5 @@ and CSS files with [stylelint](https://stylelint.io/).

The development environment is powered by Docker and Docker Compose setting up
5 containers: a PHP server, a Nginx server, a job worker, a PostgreSQL database and
a Node container running Parcel in watch mode. See the [`docker/` folder](/docker/)
a Node container running esbuild in watch mode. See the [`docker/` folder](/docker/)
for more information.
Loading

0 comments on commit 5a98887

Please sign in to comment.