Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can we have assets in a separate directory to the main html file?

See original GitHub issue

So my previous webpack config would generate something which looked like this. html-webpack-plugin

├── index.html
└── ui-assets
    ├── assets-manifest.json
    ├── main.d2fe0910b8.js
    ├── vendor.67dfc8f6a1.js

This was useful to us because we didn’t want the main entry point (index.html) to be hashed. it also allowed us to serve static assets from a different place.

@chialab/esbuild-plugin-html@0.15.0 generates this:

├── 1-25MTWOSN.js
├── 1-LCOOVKTY.css
└── index-LJMJ3LED.html

We don’t want the main entry point hashed, and we would like the assets (JS and css files) to be in a separate directory.

Is this possible for you to implement?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

edoardocavazzacommented, Mar 4, 2022

Oops, I forgot a console.log, removed in 0.15.4.

I hadn’t see before that your assets were CSS and JS files. Those files are considered chunks by esbuild, not assets. You have to set chunkNames: 'assets/[name]-[hash]' too.

jasonwilliamscommented, Mar 9, 2022

Hey @edoardocavazza I just noticed in watch mode (not serve), its generating new assets but the html file isn’t being updated to point to the new ones. I think this may be a bug

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with files - Learn web development | MDN
When you are working on a website locally on your computer, you should keep all the related files in a single folder that...
Read more >
How to set files inside the assets folder in index.html
For directory structure : use single dot(.) for current directory; use double dots(..) jump out the current directory.
Read more >
Manage Files & Folders in HTML Project Properly - YouTube
This assets management guide is for static HTML websites. For other frontend/backend framewroks like ReactJS, AngularJS, WordPress or ...
Read more >
How to make html files output to a different directory · Issue #665
Goal: Have sub-folders with index.html that can reference the assets using relative path. Reason: On S3 I want to have multiple websites in...
Read more >
Adding an assets directory to GitHub Pages | The Least You ...
Adding an assets directory to GitHub Pages. GitHub Pages is based on Jekyll, which expects graphic images and custom CSS to be in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found