UNPKG

1.98 kBJavaScriptView Raw
1"use strict";
2exports.defaults = function() {
3 return {
4 clientJadeStatic: {
5 outputExtension: '.html',
6 extensionRegex: /.html.[a-zA-Z]+$/,
7 context: {}
8 }
9 };
10};
11
12exports.placeholder = function() {
13 return "\t\n\n # clientJadeStatic: # settings for the client-jade-static module\n # context:{} # An object of data to be passed into jade compilation.\n # Use this to define the values for any variables that\n # may be in the .html.jade files. Make this object as\n # big as it needs to be to satisfy the needs of your\n # jade files.\n # outputExtension: '.html' # The extension to use for files output by jade\n # compilation.\n # extensionRegex: /.html.[a-zA-Z]+$/ # The regex to use to match jade files to be compiled\n # Files must still end in .jade or in whatever the\n # compiler override is for the jade compiler.";
14};
15
16exports.validate = function(config, validators) {
17 var errors;
18 errors = [];
19 if (validators.ifExistsIsObject(errors, "clientJadeStatic config", config.clientJadeStatic)) {
20 validators.ifExistsIsObject(errors, "clientJadeStatic.context", config.clientJadeStatic.context);
21 if (!(config.clientJadeStatic.extensionRegex instanceof RegExp)) {
22 errors.push("clientJadeStatic.extensionRegex must be an instance of RegExp");
23 }
24 if (validators.ifExistsIsString(errors, "clientJadeStatic.outputExtension", config.clientJadeStatic.outputExtension)) {
25 if (config.clientJadeStatic.outputExtension.indexOf('.') !== 0) {
26 config.clientJadeStatic.outputExtension = "." + config.clientJadeStatic.outputExtension;
27 }
28 }
29 }
30 return errors;
31};