Skip to content

hiloteam/seinjs-png-compress-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seinjs-png-compress-processor

Compress png files with webpack loaders for Sein.js.

Install

npm i seinjs-png-compress-processor --save-dev

Usage

in webpack.config.js:

{
  module: {
    rules: [
      {
          test: /\.(gltf|glb)$/,
          use: [
            {
              loader: 'seinjs-gltf-loader',
              options: {
                ......
                process: {
                  enabled: true,
                  processors: [
                    new SeinJSPNGCompressProcessor({
                      /**
                       * Which files will be processed.
                       * 
                       * @default /\.png/g
                       */
                      test: /\.png/g,
                      /**
                       * Palette size(how many colors you want to have) if `quantized` is true.
                       * 
                       * @default 256
                       */
                      psize: 200,
                      /**
                       * You can overwrite settings for each file.
                       */
                      custom: (filePath: string, data: Buffer) => {
                        if (/haha/.test(filePath)) {
                          return {psize: 100, skip: false};
                        }
                      }
                    })
                  ]
                }
              }
            }
          ]
      }
    ]
  }
}

About

Compress png files with webpack loaders for Sein.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published