
Product
Redesigned Repositories Page: A Faster Way to Prioritize Security Risk
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
glslify-import-loader
Advanced tools
A webpack loader for glslify
that adds an import
directive to your shaders.
Alternatively, you may apply these loaders automatically to all .glsl, .frag and .vert files by adding some additional configuration:
const webpack = require('webpack');
module.exports = {
module: {
rules: [{
test: /\.(glsl|frag|vert)$/,
exclude: /node_modules/,
loader: 'glslify-import-loader'
}, {
test: /\.(glsl|frag|vert)$/,
exclude: /node_modules/,
loader: 'raw-loader'
}, {
test: /\.(glsl|frag|vert)$/,
exclude: /node_modules/,
loader: 'glslify-loader'
}]
}
}
Given a common shader(common.glsl):
varying vec3 color;
You can import ./common.glsl
:
#pragma glslify: import('./common.glsl')
void main() {
gl_FragColor = vec4(color, 1.0);
}
/***/
/* 10 */
/***/ (function(module, exports) {
module.exports = "varying vec3 color;\n"
/***/ }),
/* 11 */
/***/ (function(module, exports) {
module.exports = "" + __webpack_require__(10) + "void main() {\n \ngl_FragColor = vec4(color, 1.0);\n}"
/***/ }),
glslify-import will import all glsl to a single module, the result of above example will be:
/* 11 */
/***/ (function(module, exports) {
module.exports = "varying vec3 color;\nvoid main() {\n \ngl_FragColor = vec4(color, 1.0);\n}"
/***/ }),
FAQs
glslify-import-loader
The npm package glslify-import-loader receives a total of 127 weekly downloads. As such, glslify-import-loader popularity was classified as not popular.
We found that glslify-import-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
Security News
Slopsquatting is a new supply chain threat where AI-assisted code generators recommend hallucinated packages that attackers register and weaponize.
Security News
Multiple deserialization flaws in PyTorch Lightning could allow remote code execution when loading untrusted model files, affecting versions up to 2.4.0.