Derby-standalone templates serializer
npm install grunt-derby-views> Derby-standalone templates serializer
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:
``shell`
npm install grunt-derby-views --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-derby-views');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
derby_views: {
default: {
options: {
// Options go here.
},
files: {
// src and dest-files go here
}
}
}
})
`$3
#### options.minify
Type:
Boolean
Default value: true#### options.moduleName
Type:
String
Default value: viewsName of the resulting module (you should use it in your derby-app like this require('moduleName'))
#### options.cwd
Type:
String
Default value: Gruntfile dirBase dir.
#### options.compilers
Type:
Object
Default value: {}Hash of compilers. For example:
{'.jade': require('derby-jade')}$3
#### Default Options
In this example, the default options are used to serialize derby-templates.
Additional
watch-task is used to live-reload. `js
module.exports = function (grunt) { // load all npm grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
derby_views: {
default: {
options:{
cwd: 'example'
},
files: {
'views.js': ['views/templates.html']
}
}
},
watch: {
css: {
files: 'example/views/templates.html',
tasks: ['derby_views'],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-derby-views');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['derby_views', 'watch']);
};
``