Skip to content

pastleo/esbuild-meta-into-html-script-src

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esbuild-meta-into-html-script-src

Installation

npm install [-g|--save] esbuild-meta-into-html-script-src

then use on commandline (npx esbuild-meta-into-html-script-src ...) or in scripts of package.json to automate

Usage

esbuild-meta-into-html-script-src metaJsonPath srcHtmlPath desHtmlPath [srcPrefix [desPrefix]]

srcPrefix and desPrefix: prefix to remove in meta json mapping, for example, entering srcPrefix: 'src/', desPrefix: 'dist/' will make:

'src/web.js': 'dist/web-NPBBEE7I.js'

become:

'web.js': 'web-NPBBEE7I.js'

Example

esbuild-meta-into-html-script-src meta.json src/index.html dist/index.html src/ dist/

Get entryPointMapping from generated html

window.ENTRY_POINTS_MAPPING = typeof window !== 'undefined' ? JSON.parse(
  document.head.querySelector('meta[name=entry-points-mapping]')?.content || '{}'
) : {}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published