Merges all shader files into one file in a object structure.
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-shader-concat --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-shader-concat');
In your project's Gruntfile, add a section named shader_concat
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
shader_concat: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Type: String
Default value: \n
A string value that defines the line break in your shader files. This is needed to split the file content in lines.
Type: String
Default value: frag
A string value that is used to determine if the file parsed is a fragment shader.
Type: String
Default value: vert
A string value that is used to determine if the file parsed is a vertex shader.
Type: Boolean
Default value: true
A boolean value that determines if the shaders should be subgrouped by shader type.
In the shader files you can use two directives to control the group and name of the shader in the final file.
Default value: default
.
For example: //#shader-concat-group ssao
//#shader-concat-group ssao
precision mediump float;
void main() {
// etc
}
For example: //#shader-concat-name merger
//#shader-concat-name merger
precision mediump float;
void main() {
// etc
}
grunt.initConfig({
shader_concat: {
options: {},
files: {
'tmp/default_options': [
'test/fixtures/shader1.frag',
'test/fixtures/shader1.vert'
]
},
},
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)