Skip to content

h1ve2/assetpack-plugin-declaration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assetpack-plugin-declaration

简体中文

Automatically build declaration files when using assetpack

After use, the [/\ .] in the alias of the resources in the manifest will be automatically replaced with the underscore "_" for the IDE to provide prompt functionality

Usage

1. .assetpack.js

import  {buildDeclaration} from "assetpack-plugin-declaration"
...

export default {
  ...
  pipes: [
    ...
    pixiManifest({
        output: './src/manifest.json',
    }),
    buildDeclaration() // Add to the end
  ]
};
...

2. use assets

import {assets, loadBundle} from "./assets"; // The assets file is generated by this plugin.
...
await loadBundle('loading');
const pic = Sprite.from(assets.loading_pic);

app.stage.addChild(pic);

Options

{

    dist?:string, // declaration file save path, default: "./src/assets.ts"
    
    objectName?: string, // assets object name, default:  "assets"
    
    createLoadFunction?: { // create loadBundle method, default: true
    
        /**
         *  Whether to automatically inject into PIXI.Assets, default: false
         *  If true, it directly uses the built-in Assets.loadBundle() of PIXI.
         */
        changePixiAssets?: boolean 
        
    }

}

About

Automatically build declaration files when using assetpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published