Builds the textfiles.js manifest needed to import data and template textfiles into requireJS for eDetails Based on original makeTextFiles npm module: https://github.com/incuna/maketextfiles
This plugin requires Grunt ~0.4.2
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-maketextfiles --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-maketextfiles');
In your project's Gruntfile, add a section named maketextfiles
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
//if you are using grunt watch, add
watch: {
options: {
atBegin: true,
interrupt: true
},
textFilesProject: {
files: [
'project/data/**/*.{json, yaml}',
'project/templates/**/*.html',
],
tasks: ['maketextfiles'],
options: {
event: ['added', 'deleted'],
}
},
textFilesJam: {
files: [
'project/jam/require.config.js'
],
tasks: ['maketextfiles'],
}
}
});
Type: Object
Default value: grunt.file.readJSON('package.json')
The contents of package.json
where textDirs
are set.
Type: String
Default value: project/
The name of the project folder to search in.
Type: String
Default value: project/textFiles.js
The name of the output file relative to the Gruntfile.
These would be the default options as used in a Gruntfile.
grunt.initConfig({
makeTextFiles: {
options: {
projectPackage: grunt.file.readJSON('package.json'),
projectBasePath: 'project/',
destinationFileName: 'project/textFiles.js',
},
},
});
This task reads text directories from package.json file for the main project and jam packages.
Text file definitions must be declared inside the textDirs
property in a package file. This is an array of objects to parse, each containing these properties:
Type: String
Relative path of the directory to parse
Type: array
Array of file extensions to match inside the textDirs.path
"textDirs": [
{
"path": "data"
"fileTypes": [
"json",
"yaml"
]
},
{
"path": "templates"
"fileTypes": [
"html"
]
}
]
- 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.
- To release:
- Update
package.json
with version number (use semver) - Update
CHANGELOG.md
- Tag release with version number
- Update