pixijs / assetpack

A configurable asset pipeline for the web
http://pixijs.io/assetpack/
MIT License
96 stars 20 forks source link

Feature: Improve configuration options for Pixi Manifest generation #33

Open luke-thompson-vgw opened 1 year ago

luke-thompson-vgw commented 1 year ago

Thanks for the great work on assetpack, I've been experimenting to see if I can integrate it into a project and an into a couple of issues related to creating a Pixi manifest.

The first issue is with customising output directory.

The manifest plugin generates file paths for the manifests "srcs" property, but I can't see a way to prepend to that file path.

I'm using Vite and directing assetpack to output to the 'public' directory deletes everything in that folder so I can't host any public assets not handled by assetpack.

I think it would be useful to be able to prepend to the file path that is created by the manifest plugin so the files handled by assetpack can all be placed in a sub directory and the "srcs" property in the Pixi manifest still be correct.

The second issue is with handling Spine files.

I would like to have the Spine json files added to the generated Pixi manifest, but not the atlas files. It currently adds the Spine json, atlas and png files all to the manifest then Pixi fails when it tries to load the atlas file as an image.

What I think would work is if we could add an ignore property to the manifest plugin options so that we can specify which files should not be added to the manifest. Whilst still allowing assetpack to move the files to the output directory.

Zyie commented 1 year ago

Hey @luke-thompson-vgw thanks for the feedback!

I'm not entirely sure what you mean with your first issue. Could you give me a current/expected result for the manifest?

As for the spine issue, yes i think adding the ability to ignore certain files in the manifest is a good idea. I'll add that to the list.

luke-thompson-vgw commented 1 year ago

Thanks for asking for more information. Whilst checking my work in order to explain the issue better I have found the solution is actually already in the Pixi Assets class.

The below code solves my problem.

Assets.init({ basePath: "folder-name/", manifest: assetManifest });

I was trying to add a folder to the base path of where Pixi should load the assets in the asset manifest from, but it can be done by passing an option in to the Assets.init method already. So you can disregard that first issue.

As for the second issue. I'd be happy to try make the change to add an ignore list and submit a PR when I get a chance to do the work. Would that be welcome?