evanw / evanw/esbuild

Support of dynamic banner

Open
#3,291 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I would like to have in banner date&time of the build. I used the pseudocode below, but the initial value stays in the output constantly. Am I doing something wrong, or this is not supported right now?


let bannerForCSS = '/* initial value */';

const esbuildOptions = {
  banner: {
    css: bannerForCSS,
  },
  plugins: [
    {
      name: 'timestamp',
      setup(build) {
        build.onStart(() => {
          const timestamp = new Date().toLocaleTimeString('en-UK');
          bannerForCSS = `/* Automatic build at: ${timestamp} */`;
        });
      },
    }
  ]
};

const ctx = await esbuild.context(esbuildOptions);
await ctx.watch();

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the banner.css option and the plugin setup, build.onStart, context, and watch entry points shown in the example. Determine whether the banner is evaluated once or can change on rebuild; done means the supported behavior and any required change are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.