Norvell's Public Machinations

    gulp-angular-templates-lite

    1.0.0 • Public • Published

    gulp-angular-templates-lite

    Lightweight Gulp task to convert AngularJS (v1) html templates to javascript that uses the template cache.

    Install

    npm install gulp-angular-templates-lite --save-dev
    

    Usage

    const gulp = require('gulp');
    const htmlmin = require('gulp-htmlmin');
    const angularTemplates = require('gulp-angular-templates-lite');
    const concat = require('gulp-concat');
    
    function buildTemplates () {
        return gulp.src('client/app/**/*.html')
            .pipe(htmlmin({}))  // Optional: miminize the HTML before converting to javascript
            .pipe(angularTemplates()) // Convert each HTML file to a single line of javascript
            .pipe(concat('templates.js')) // Concatenate the lines of javascript to a single javascript file
            .pipe(angularTemplates.wrap('myApp')) // Wrap the lines of template javascript using provided angular module name 
            .pipe(gulp.dest('.tmp/')); // Output the templates.js the specified directory
    }

    Install

    npm i gulp-angular-templates-lite

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    6.28 kB

    Total Files

    5

    Last publish

    Collaborators

    • schinkowitch