Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adapter-template

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adapter-template - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

lib/setModuleDefaults.js

21

adapters/generic.js

@@ -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

lib/adapter.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc