JSPM

compress-shader-loader

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 143
  • Score
    100M100P100Q85139F
  • License MIT

A webpack loader that removes comments and excess whitespace and then inlines the resource into the bundle

Package Exports

  • compress-shader-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (compress-shader-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Compress Shader Loader

This loader was designed to aid in development with the DeltaV framework. It allows for shader code and fragments to be written into separate files and then inlined into the bundle for your project.

Installation and Use

To install simply:

npm install compress-shader-loader

This example will load .fs and .vs files and inline their contents into your bundle:

{
  "modules": {
    "rules": [
      { "test": /\.[fv]s$/, "use": ["shader-compress-loader"] },
    ]
  }
}

Recommendations

I would recommend using raw-loader to inline your shader files in development mode and use this loader for production. Something like this:

...
  { test: /\.[fv]s$/, use: IS_PRODUCTION ? ['shader-compress-loader'] : ['raw-loader'] },
...

This will help you have a MUCH more useful debugging experience.