
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
grunt-batman-templates
Advanced tools
Generates precache commands for Batman templates to pre-populate
Batman.View.store
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-batman-templates --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-batman-templates');
In your project's Gruntfile, add a section named batman_templates
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
batman_templates: {
options: {
templateFolder: 'app/html' // optional, defaults to 'app/html'
},
files: {
src: 'app/html/**/*.html'
dest: 'batman-view-precache.js'
}
}
});
The following shows what the resulting batman-view-precache.js
file looks like, based on the unit tests:
Batman.View.store.set('posts/index', '<h1>Welcome to the Posts Page</h1>\n<ul class=\"posts\">\n <li class=\"post\" data-foreach-post=\"posts\">\n <span class=\"title\" data-bind=\"post.title\"></span>\n <span class=\"created-at\" data-bind=\"post.created_at\"></span>\n </li>\n</ul>\n');
Batman.View.store.set('posts/show', '<h1>Post: <span data-bind=\"post.title\"></span></h1>\n<span class=\"created-at\" data-bind=\"post.created_at\"></span>\n<div data-bind=\"post.content\"></div>\n');
Batman.View.store.set('posts/subfolder/subtemplate', '<h1>This is a special template</h1>\n<div>Verifies that subfolder path lookups in the task work</div>\n');
Batman.View.store.set('products/index', '<h1>Welcome to the Posts Page</h1>\n<ul class=\"products\">\n <li class=\"product\" data-foreach-product=\"products\">\n <span class=\"name\" data-bind=\"product.name\"></span>\n <span class=\"price\" data-bind=\"product.price\"></span>\n </li>\n</ul>\n');
You would include this JavaScript file after your Batman application code ie:
<script src="/path/to/batman.js"></script>
<script src="/path/to/my-batman-app.js"></script>
<script src="/path/to/batman-view-precache.js"></script>
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
grunt-batman-templates was created by David Mosher, and is distributed under the MIT license.
FAQs
Generates and stores BatmanJS templates in the Batman HTMLStore
The npm package grunt-batman-templates receives a total of 12 weekly downloads. As such, grunt-batman-templates popularity was classified as not popular.
We found that grunt-batman-templates 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.