{"_id":"webpack-glsl-loader","_rev":"4-07c013556f80e2d4a95c816f17f1feeb","name":"webpack-glsl-loader","description":"A webpack loader for glsl shaders - includes support for nested imports.","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"webpack-glsl-loader","version":"1.0.1","description":"A webpack loader for glsl shaders - includes support for nested imports.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/grieve/webpack-glsl-loader.git"},"keywords":["glsl","shader","webgl","webpack","loader","import","include"],"author":{"name":"Ryan Grieve","email":"me@ryangrieve.com","url":"http://ryangrieve.com"},"license":"MIT","bugs":{"url":"https://github.com/grieve/webpack-glsl-loader/issues"},"homepage":"https://github.com/grieve/webpack-glsl-loader#readme","dependencies":{"fs":"0.0.2","path":"^0.11.14"},"gitHead":"6a27d0d7bf4cf19a619f59dbf729b22eb2432b65","_id":"webpack-glsl-loader@1.0.1","_shasum":"72a0e30192bd57947d60d6d505c915be680d0acc","_from":".","_npmVersion":"2.8.3","_nodeVersion":"0.10.38","_npmUser":{"name":"grieve","email":"me@ryangrieve.com"},"dist":{"shasum":"72a0e30192bd57947d60d6d505c915be680d0acc","tarball":"https://registry.npmjs.org/webpack-glsl-loader/-/webpack-glsl-loader-1.0.1.tgz","integrity":"sha512-bFtjj+sOGECMKQ+o8V4Y0TdrIxiua6ykVAncj5ccws8ezZBhhz+9wdrQqSgawm2IS3SPjoVaF7yxSAS8naNirg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDLqa/6E7ImvGwpyaXDtBDvzUSQgWF92RSCt+2O+UFpuAIhANmvszx94cKvR9u4Bke6NtW1Df1hF9IzAFzxYT0prCtQ"}]},"maintainers":[{"name":"grieve","email":"me@ryangrieve.com"}]}},"readme":"# Webpack loader for GLSL shaders\n\nA glsl shader loader for webpack, includes support for nested imports, \nallowing for smart code reuse among more complex shader implementations. \nThe shader is returned as a string.\n\n## Install\n\n```shell\nnpm install --save-dev webpack-glsl-loader\n```\n\n## Usage\n\n### With `require`\n\n> **N.B.** As noted in the [webpack documentation](\nhttp://webpack.github.io/docs/using-loaders.html#loaders-in-require), you\nshould avoid using this and use the configuration method in the next section.\n\n```javascript\nrequire('webpack-glsl!./my-lovely-shader.glsl`;\n```\n\n### In configuration\n\n```javascript\n{\n    module: {\n        loaders: [\n            {\n                test: /\\.glsl$/,\n                loader: 'webpack-glsl'\n            }\n        ]\n    }\n}\n```\n\nand then\n\n```javascript\nrequire('./my-lovely-shader.glsl`;\n```\n\n### On command line\n\nYou can also define the module extension bind on the command line if you are\nnot using a configuration file (you probably should be though).\n\n```shell\nwebpack --module-bind 'glsl=webpack-glsl'\n```\n\n## Imports\n\nThis loader supports an import syntax to allow you to maximise your code reuse\nand keep those shaders\n[DRY](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself). This syntax is \nvery similar to that of SASS.\n\n### Example\n\nExample project structure:\n```\nsrc/\n---- js/\n---- ---- main.js\n---- glsl/\n---- ---- includes/\n---- ---- ---- perlin-noise.glsl\n---- ---- fragment.glsl\n```\n\nIf I require my fragment shader inside `main.js`:\n\n```javascript\nvar shader = require('../glsl/fragment.glsl');\n```\n\nI can have that shader include other `.glsl` files inline, like so:\n\n```sass\n@import ./includes/perlin-noise;\n```\n\n> **N.B.** all imports within `.glsl` files exclude the file extension and \nare relative to the file doing the importing.\n\nImported files are parsed for `@import` statements as well, so you can nest\nimports as deep as you'd like (although, you should probably rethink your\nshader if you require any more than 2 levels).\n\nImported files are inserted directly into the source file in place of the\n`@import` statement and no special handling or error checking is provided. So,\nif you get syntax errors, please first check that shader works as one \ncontiguous file before raising an issue.\n\n## TODO\n\n+ Deduplicate imports, to prevent code clobbering and conflicts at runtime\n+ Make loader file extension agnostic, to allow for you odd people who use\nother extensions like `.vert` and `.frag`.\n","maintainers":[{"name":"grieve","email":"me@ryangrieve.com"}],"time":{"modified":"2022-06-28T23:53:44.935Z","created":"2015-05-21T10:36:09.170Z","1.0.1":"2015-05-21T10:36:09.170Z"},"homepage":"https://github.com/grieve/webpack-glsl-loader#readme","keywords":["glsl","shader","webgl","webpack","loader","import","include"],"repository":{"type":"git","url":"git+https://github.com/grieve/webpack-glsl-loader.git"},"author":{"name":"Ryan Grieve","email":"me@ryangrieve.com","url":"http://ryangrieve.com"},"bugs":{"url":"https://github.com/grieve/webpack-glsl-loader/issues"},"license":"MIT","readmeFilename":"README.md","users":{"cheister":true}}