Need help with glslify-loader?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

glslify
147 Stars 23 Forks Other 16 Commits 6 Opened issues

Description

:floppy_disk: glslify loader module for webpack

Services available

!
?

Need anything else?

Contributors list

glslify-loader

glslify loader module for webpack.

Installation

npm install glslify-loader

Generally, you'll want to use this alongside webpack's raw-loader module:

sh
npm install raw-loader

Usage

Documentation: Using Loaders in Webpack

Configuration file
module.exports = {
  rules: [
    {
      test: /\.(glsl|vs|fs|vert|frag)$/,
      exclude: /node_modules/,
      use: [
        'raw-loader',
        'glslify-loader'
      ]
    }
  ]
}
Inline
// Using require
const source = require('raw-loader!glslify-loader!./my-shader.glsl')

// Using ES6 import statement import source from 'raw-loader!glslify-loader!./my-shader.glsl'

Speficy source transforms

See Glslify Source Transforms for details.

module.exports = {
  rules: [
    {
      test: /\.(glsl|frag|vert)$/,
      exclude: /node_modules/,
      use: [
        'raw-loader',
        {
          loader: 'glslify-loader'
          options: {
            transform: [
              ['glslify-hex', { 'option-1': true, 'option-2': 42 }]
            ]
          }
        }
      ]
    }
  ]
}

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.