Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 1.38 KB

README.md

File metadata and controls

56 lines (45 loc) · 1.38 KB

esbuild-plugin-glslify-minify

Compile GLSL shaders and minify. Based on the following projects:

Usage

npm install --save-dev @befunky/esbuild-plugin-glslify-minify

Configuration

esbuildPluginGlslifyMinify({
  // What extensions to compile. Defaults:
  extensions: ['vs', 'fs', 'vert', 'frag', 'glsl'],

  // Glslify options
  // See https://github.com/glslify/glslify#var-src--glslcompilesrc-opts
  glslify: {
    basedir: './helpers',
  },

  // Minification options 
  // See https://github.com/leosingleton/webpack-glsl-minify#loader-options
  minify: {
    preserveUniforms: true,
    preserveDefines: true,
    removeGlslifyDefinition: true, // Removes "#define GLSLIFY 1", false by default
  },

  // To avoid minification, omit the config or set it to a falsy value, e.g.
  minify: false,

});

Usage in Gulp task

import gulpEsbuild from 'gulp-esbuild';
import esbuildPluginGlslifyMinify from 'esbuild-plugin-glslify-minify';

gulp.task('js-app', () => {
  return gulp.src('./path/to/index.js')
    .pipe(gulpEsbuild({
      plugins: [
        esbuildPluginGlslifyMinify({
          // See configuration (above)
        }),
      ],
      // other esbuild options
    }))
});