
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
gulp-teddy
Advanced tools
Compiles Teddy templates
$ npm install --save-dev gulp-teddy
src/html/index.html<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<title>Title</title>
</head>
<body>
<include src='templates/header.html'>
<arg mainTitle>Main title</arg>
</include>
</body>
</html>
src/html/templates/header.html<header>
<if mainTitle>
<h1>{mainTitle}</h1>
</if>
<else>
<p>No main title</p>
</else>
</header>
gulpfile.jsvar gulp = require('gulp'),
teddy = require('gulp-teddy').settings({
setTemplateRoot: 'src/html/'
});
gulp.task('default', () => gulp.src(['src/html/**/*.html','!src/html/templates/**/*.html'])
.pipe(teddy.compile())
.pipe(gulp.dest('dist'))
);
dist/index.html<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width" />
<title>Title</title>
</head>
<body>
<header>
<h1>Main title</h1>
</header>
</body>
</html>
src/html/index.html<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<title>Title</title>
</head>
<body>
<loop through='letters' val='letter'>
<p>{letter}</p>
</loop>
</body>
</html>
gulpfile.jsvar gulp = require('gulp'),
teddy = require('gulp-teddy').settings({
setTemplateRoot: 'src/html/'
});
gulp.task('default', () => gulp.src(['src/html/**/*.html', '!src/html/templates/**/*.html'])
.pipe(teddy.compile({
letters: ['a', 'b', 'c']
}))
.pipe(gulp.dest('dist'))
);
dist/index.html<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width" />
<title>Title</title>
</head>
<body>
<p>a</p>
<p>b</p>
<p>c</p>
</body>
</html>
For example from a json file, you can use it together the above example, your data will be merged (extended)
src/html/index.html<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<title>Title</title>
</head>
<body>
<if subTitle>
<h2>{subTitle}</h2>
</if>
<if subData and subData.level1>
<ul>
<loop through='subData.level1' key='name' val='text'>
<li>
<strong>{name}</strong>
<br />{text}
</li>
</loop>
</ul>
</if>
</body>
</html>
src/data/index.json{
"subTitle": "Sub title",
"subData": {
"level1": {
"sd1": "sub data 1",
"sd2": "sub data 2",
"sd3": "sub data 3"
}
}
}
gulpfile.jsvar gulp = require('gulp'),
data = require('gulp-data'),
path = require('path'),
teddy = require('gulp-teddy').settings({
setTemplateRoot: 'src/html/templates/'
});
gulp.task('default', function() {
return gulp.src(['src/html/**/*.html', '!src/html/templates/**/*.html'])
.pipe(data(function(file) {
return require('./src/data/' + path.basename(file.path, '.html') + '.json');
}))
.pipe(teddy.compile({
letters: ['a', 'b', 'c']
}))
.pipe(gulp.dest('dist'));
});
dist/index.html<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width" />
<title>Title</title>
</head>
<body>
<h2>Sub title</h2>
<ul>
<li>
<strong>sd1</strong>
<br/>sub data 1
</li>
<li>
<strong>sd2</strong>
<br/>sub data 2
</li>
<li>
<strong>sd3</strong>
<br/>sub data 3
</li>
</ul>
</body>
</html>
Type: Object
{
setTemplateRoot: './',
setVerbosity: 0,
strictParser: false,
enableForeachTag: false,
compileAtEveryRender: false
}
See the Teddy docs.
Type: Object
The compile method executes the original teddy.render() method with a template path and the optional data param.
The original teddy.compile() method is not allowed, this plugin is for generating static html files with the help of the Teddy templating engine functionalities.
FAQs
Teddy template compiler gulp plugin
The npm package gulp-teddy receives a total of 11 weekly downloads. As such, gulp-teddy popularity was classified as not popular.
We found that gulp-teddy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.