adapter-template
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -5,2 +5,7 @@ /** | ||
require('../lib/setModuleDefaults'); | ||
var config = require('config'); | ||
var engineConfig = config.engines ? config.engines : undefined; | ||
/** | ||
@@ -10,9 +15,19 @@ * Return a function that creates a plugin: | ||
module.exports = function(engineName){ | ||
module.exports = function(language){ | ||
return { | ||
attach: function (/* options */){ | ||
this.engine = require(engineName); | ||
/** | ||
* If there is a specified engine for this language then use it, | ||
* otherwise just use the provided name: | ||
*/ | ||
var module = (engineConfig && engineConfig[language]) | ||
? engineConfig[language].module | ||
: language; | ||
this.engine = require(module); | ||
} | ||
, name: 'adapter-' + engineName | ||
, name: 'adapter-' + language | ||
}; | ||
}; |
@@ -6,3 +6,3 @@ /** | ||
module.exports = function (engineName, options){ | ||
module.exports = function (language, options){ | ||
var broadway = require('broadway'); | ||
@@ -12,6 +12,6 @@ var plugin = new broadway.App(); | ||
/** | ||
* Create an adapter for the specified engine: | ||
* Create an adapter for the specified templating language: | ||
*/ | ||
var adapter = require('../adapters/generic')(engineName); | ||
var adapter = require('../adapters/generic')(language); | ||
@@ -18,0 +18,0 @@ /** |
{ | ||
"name": "adapter-template", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Adapters to standardise the interfaces on the plethora of available templating engines.", | ||
"keywords": [ | ||
"adapter", "template", | ||
"adapter", | ||
"template", | ||
"express", | ||
@@ -15,5 +15,3 @@ | ||
"toffee", | ||
"whiskers", | ||
"consolidate" | ||
"whiskers" | ||
], | ||
@@ -24,5 +22,5 @@ "homepage": "https://github.com/stakk/adapter-template", | ||
"main": "./lib/adapter", | ||
"repository" : { | ||
"type" : "git" | ||
, "url" : "http://github.com/stakk/adapter-template.git" | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/stakk/adapter-template.git" | ||
}, | ||
@@ -37,6 +35,10 @@ "scripts": { | ||
"ejs": "~1.0.0", | ||
"hbs": "~2.7.0", | ||
"jade": "~1.3.1", | ||
"swig": "~1.4.1", | ||
"toffee": "~0.1.12", | ||
"whiskers": "~0.3.3" | ||
"whiskers": "~0.3.3", | ||
"config": "~1.0.1", | ||
"js-yaml": "~3.1.0" | ||
}, | ||
@@ -43,0 +45,0 @@ "devDependencies": { |
@@ -47,3 +47,3 @@ adapter-template | ||
* provide Express support by way of the `express()` method; | ||
* provide Express support by way of the `express()` or `renderFile()` method; | ||
* have the same module name as the template file extension. | ||
@@ -53,2 +53,19 @@ | ||
# Adding an Express-compatible Engine Named Differently to Its Language | ||
The next most simple templating engine to support are those that: | ||
* provide Express support by way of the `express()` or `renderFile()` method; | ||
* have a different module name to the template file extension. | ||
As described in the previous section, an entry is needed in `package.json` and a template must be added to the fixtures collection in the tests directory in order to trigger tests. But in addition an entry is needed in `lib/setModuleDefaults.js` to indicate what the real module name is. For example, to use the module `hbs` to provide Handlebars support, the following needs to be added to the default settings: | ||
```javascript | ||
handlebars: { | ||
module: 'hbs' | ||
} | ||
``` | ||
Without this entry the generic adapter will try to load a module called `handlebars`. | ||
# Template Languages Supported: | ||
@@ -58,2 +75,3 @@ | ||
* ejs | ||
* handlebars | ||
* jade | ||
@@ -66,2 +84,7 @@ * swig | ||
## 2014-07-28 (v0.6.0) | ||
Add handlebars support. | ||
Enable modules to have a different name to the template language they support. | ||
## 2014-07-25 (v0.5.0) | ||
@@ -68,0 +91,0 @@ Add swig support. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
11169
22
129
104
10
3
+ Addedconfig@~1.0.1
+ Addedhbs@~2.7.0
+ Addedjs-yaml@~3.1.0
+ Addedargparse@0.1.16(transitive)
+ Addedconfig@1.0.2(transitive)
+ Addedesprima@1.0.4(transitive)
+ AddedforEachAsync@2.2.1(transitive)
+ Addedhandlebars@1.3.0(transitive)
+ Addedhbs@2.7.0(transitive)
+ Addedjs-yaml@3.1.0(transitive)
+ Addedoptimist@0.6.1(transitive)
+ Addedsequence@2.2.1(transitive)
+ Addeduglify-js@2.3.6(transitive)
+ Addedunderscore@1.7.0(transitive)
+ Addedunderscore.string@2.4.0(transitive)
+ Addedwalk@2.2.1(transitive)
- Removedsource-map@0.1.43(transitive)