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

templatizer

Package Overview
Dependencies
Maintainers
3
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

templatizer - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

6

output_template.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
define([{{amdModuleDependencies}}], factory);
} else if (typeof exports === 'object') {

@@ -11,4 +11,4 @@ module.exports = factory();

}
}(this, function () {
{{jade}}
}(this, function ({{amdDependencies}}) {
{{jade}}

@@ -15,0 +15,0 @@ var {{internalNamespace}} = {};

{
"name": "templatizer",
"description": "Simple solution for compiling jade templates into vanilla JS functions for blazin' fast client-side use.",
"version": "1.2.1",
"version": "1.3.0",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -23,3 +23,3 @@ "bin": "./bin/cli",

"glob": "^4.3.5",
"jade": "^1.7.0",
"jade": "^1.9.2",
"lodash": "^3.2.0",

@@ -37,2 +37,3 @@ "minimist": "^0.1.0",

"precommit-hook": "^1.0.7",
"requirejs": "^2.1.16",
"testee": "^0.1.1",

@@ -44,5 +45,5 @@ "underscore": "^1.7.0",

"keywords": [
"templates",
"browser",
"jade"
"jade",
"templates"
],

@@ -57,7 +58,9 @@ "license": "MIT",

"benchmark": "node benchmark/speedtest.js",
"browserify": "./node_modules/.bin/browserify test/browserify-test.js > test/tests-bundle.js",
"browserify": "./node_modules/.bin/browserify test/tests-browserify.js > test/tests-browserify-bundle.js",
"build": "npm run copy-runtime && node build.js",
"copy-require": "cp node_modules/requirejs/require.js test/require.js",
"copy-runtime": "cp node_modules/jade/lib/runtime.js jaderuntime.js",
"copy-underscore": "cp node_modules/underscore/underscore.js test/underscore.js",
"setup-test": "npm run build && npm run browserify && npm run copy-underscore",
"lint": "jshint .",
"setup-test": "npm run build && npm run browserify && npm run copy-underscore && npm run copy-require",
"start": "npm run setup-test && http-server -p 3003 test/",

@@ -64,0 +67,0 @@ "test": "npm run setup-test && testee test/index.html"

@@ -100,2 +100,10 @@ # templatizer.js

#### `inlineJadeRuntime` (boolean, default true)
By default the jade runtime will be included into the generated template javascript file. In order minimize the file size you can set this parameter to false. Instead a `jade` module is expected as amdDependency parameter. Otherwise an error will be thrown.
#### `amdDependencies` (array, default [])
An array of AMD module dependencies you want to pass in to the generated templates javascript file.
#### `jade` (object, default `{}`)

@@ -102,0 +110,0 @@

@@ -32,2 +32,4 @@ var jade = require('jade');

dontRemoveMixins: false,
amdDependencies: [],
inlineJadeRuntime: true,
jade: {},

@@ -41,2 +43,10 @@ namespace: '' // No namespace means 'window'

var amdModuleDependencies = '';
var amdDependencies = '';
if(_.isArray(options.amdDependencies) && !_.isEmpty(options.amdDependencies)) {
amdModuleDependencies = "'" + options.amdDependencies.join("','") + "'";
amdDependencies = options.amdDependencies.toString();
}
var namespace = _.isString(options.namespace) ? options.namespace : '';

@@ -160,2 +170,5 @@ var folders = [];

if(!options.inlineJadeRuntime)
wrappedJade = '';
var indentOutput = output.split('\n').map(function (l) { return l ? ' ' + l : l; }).join('\n');

@@ -166,3 +179,5 @@ var finalOutput = outputTemplate

.replace('{{jade}}', wrappedJade)
.replace('{{code}}', indentOutput);
.replace('{{code}}', indentOutput)
.replace('{{amdModuleDependencies}}', amdModuleDependencies)
.replace('{{amdDependencies}}', amdDependencies);

@@ -169,0 +184,0 @@ if (outputFile) fs.writeFileSync(outputFile, finalOutput);

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