
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
grunt-angular-inline-templates
Advanced tools
Inline template generator for AngularJS directives.
Inline template generator for AngularJS directives.
This Grunt plugin allows you to embed AngularJS templates inside directives in order to be able to share them easily (e.g. as Bower components). I am aware that there are plenty other similar plugins however none did exactly what I wanted.
I build my directives using a Grunt workflow. They are meant to be used across projects so they sit in a Bower repository. Because of this I ran into issues regarding template paths and while I would have been able to fix this by doing string replaces in the production build or other magic things I wanted something simple that simply embedded the needed templates in the final version of the directive.
This plugin requires Grunt.
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-angular-inline-templates --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-angular-inline-templates');
In your project's Gruntfile, add a section named nginlinetemplates
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
nginlinetemplates: {
app: {
src: 'src/*.html',
dest: 'dist/your-directive.tpls.<%= pkg.version %>.js'
}
},
})
The plugin expects two options:
src
- template file or files that will be minified, escaped and concatenated.dest
- the file where the templates will be embedded.The destination file requires a special comment, /* grunt-angular-inline-templates */
inside which will be replaced with the actual templates.
(function(window, angular, undefined) {
angular.module('yourModule', ['Dep1', 'Dep2'])
/* grunt-angular-inline-templates */
.directive('yourDirective', function() {
return {
...
The production task generates four versions of the directive:
This way I cover all needed usage cases.
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code using Grunt.
If you're creating a pull request, also please add yourself to the CONTRIBUTORS.txt
file (or create it if it's necessary).
Copyright (c) 2014 Alexandru Badiu. Licensed under the MIT license.
FAQs
Inline template generator for AngularJS directives.
The npm package grunt-angular-inline-templates receives a total of 0 weekly downloads. As such, grunt-angular-inline-templates popularity was classified as not popular.
We found that grunt-angular-inline-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
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.