Excalibur icon indicating copy to clipboard operation
Excalibur copied to clipboard

Remove all `.ex` references from example code

Open KokoDoko opened this issue 10 months ago • 5 comments

Problem

Currently there are three ways to work with excalibur:

  • create a vite project
  • import excalibur modules via esm.sh
  • put a script tag in the top of the html document

The last approach (script tag) requires a different approach to using classes, you have to put ex. in front of classnames. The other approaches do not need this.

In the excalibur quickstart the vite approach is taught. In the excalibur fundementals the ex. approach is taught.

I have found that this is confusing for new game developers.

Proposal

Using ex. seems not needed anymore since we can now use import { Actor, Engine } from 'https://esm.sh/excalibur';

For that reason I propose to remove .ex prefix from tutorials and documentation and only use the modules based approach.

KokoDoko avatar Mar 16 '25 09:03 KokoDoko

@KokoDoko I can see the desire, the modules approach is definitely the way of the ESM future.

Originally we had done the ex prefix to make clear what was coming out of excalibur in the tutorial documentation, but maybe that's a flimsy reason nowadays.

I'm down to make this consistent with the new world order, @kamranayub @mattjennings @jyoung4242 any thoughts here?

eonarheim avatar Apr 03 '25 01:04 eonarheim

After thinking about this a bit, I think I agree. It's a convention that is established but is only really used in non-ESM environments.

We should probably include this in the setup code as a convention:

import * as ex from 'https://esm.sh/excalibur'
import * as ex from 'excalibur'

Then we may or may not want to also include this in example code. If we establish this in every method, maybe we can get away with not needing to inject that boilerplate every time.

mattjennings avatar Apr 03 '25 02:04 mattjennings

I personally don't use the ex import, i import each module independently. That being said, we should present a unified front in our documentation, and this is a key element IMO... just will take some work. But I agree with it being more forward looking...

jyoung4242 avatar Apr 03 '25 13:04 jyoung4242

Cool cool, I'll support removing import * as ex from all the places. Thanks for bringing this up @KokoDoko!

eonarheim avatar Apr 04 '25 14:04 eonarheim

This issue hasn't had any recent activity lately and is being marked as stale automatically.

github-actions[bot] avatar Jun 04 '25 00:06 github-actions[bot]