
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gulp-hogan-compile
Advanced tools
A gulp plugin to compile mustache HTML templates to JavaScript functions using hogan.
A gulp plugin to compile mustache HTML templates to JavaScript functions using hogan.
In templates/test.html
:
<p>Hello {{place}}</p>
In your gulpfile:
var compiler = require('gulp-hogan-compile');
gulp.task('templates', function() {
gulp.src('templates/**/*.html')
.pipe(compiler('templates.js'));
.pipe(gulp.dest('js/'));
});
In your code:
var templates = require('js/templates.js');
var html = templates.test.render({
place: 'world';
})
console.log(html); // <p>Hello world</p>
This will compile the templates into a JavaScript AMD module using hogan.compile
.
It uses the hogan-updated
module. This works with the latest version of hogan for bower (currently the npm version of hogan is ~2.0.0
, but bower is around ~3.0.0
).
It will require('hogan')
so that module needs to be available, for example by installing it with bower. You can change the name/path of the hogan module at compile time with options.hoganModule
.
string
object
string
The line delimiter, defaults to your operating system's newline.
string
Either amd
, commonjs
or false
for no wrapper, defaults to amd
. If wrapper is false
a local var templates
will be defined containing the templates.
object
Options passed through to hogan.compile
. It will always set asString
to true
, so you can't override that.
function(file)
A function that will be passed the file and should return a name for the template. By default uses the basename of the file without an extension.
string
The name of the hogan module in your app, defaults to hogan
. If you're not using a wrapper then the global Hogan
must be available.
FAQs
A gulp plugin to compile mustache HTML templates to JavaScript functions using hogan.
The npm package gulp-hogan-compile receives a total of 98 weekly downloads. As such, gulp-hogan-compile popularity was classified as not popular.
We found that gulp-hogan-compile 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.