View/init.js
View/firstMethod.js --> View.js
View/secondMethod.js
...
grunt.initConfig({
concatProperties: {
myApp: {
src: [
'View/{**/,}*.js'
],
dest: 'build/View.js'
}
}
};
Type: Array
Default value: []
Array of files masks for concatination. Files will be concated at specified sequence.
Type: String
Default value: ''
The destination file path
npm install grunt-concat-properties --save-dev
Example for constructor:
// View/init.js
MyApp.View = function () {};
MyApp.View.prototype = {
// @include prototypeProperties
};
// View/firstMethod.js
MyApp.Model.prototype.firstMethod = function () {};
// View/secondMethod.js
MyApp.Model.prototype.secondMethod = function () {};
grunt concatProperties
// build/View.js
MyApp.View = function () {};
MyApp.View.prototype = {
firstMethod: function () {},
secondMethod: function () {}
};
Also you can concat inline properties using other place definition
// @include properties
grunt.initConfig({
concatProperties: {
myApp: {
options: {
base: 'test/App/',
sourceProcessor: null,
initFiles: [
'**/init.js',
'!init.js'
]
},
src: [
'models/{**/,}*.{json,yaml,yml,js}',
'View/{**/,}*.js'
],
dest: 'build/properties.js'
}
}
};
Type: Array
Default value: []
Source files. Task can parse JS, JSON or YAML files
Type: String
Default value: ''
Path to your application from Gruntfile.js You need to specify this property only if Gruntfile.js isn`t placed at your app folder,
Type: Function
Default value: null
The function will being called for process each property source data.
For example:
/**
* @param source {String}
* @param propertyData {Object}
* @param propertyData.name {String}
* @param propertyData.source {String}
* @param propertyData.comment {String}
* @param propertyData.type {String} 'function' || 'object'
* @param propertyData.isPublic {Boolean}
* @param propertyData.isFromPrototype {Boolean}
* @param propertyData.filePath {String}
*/
function sourceProcessor (source, propertyData) {
return source;
}
Type: Array
Default value: ['**/init.js', '!init.js']
Masks of initialization files
grunt.initConfig({
concatProperties: {
myApp: {
files: {
'build/models.js': [
'models/{**/,}*.js'
],
'build/View.js': [
'View/{**/,}*.js'
]
}
}
}
};
Use some like grunt-jsbeautifier to keep indentation at concated files