1

I'm using gulp-rev module for static asset re-visioning of my source files and it generates all files - CSS, JS and HTML with new file names appending the hash code in it.

Before : app.js  
After  : app-2cba45c.js  

But in my AngularJS code and HTML pages I referred to other HTML with the actual names, how do I handle this when I use gulp-rev?

For Example:

HTML Code:

        <div class="wd pull-left colapse_border">
            <ng-include src="'views/Header.html'"></ng-include>  <!-- how to handle this -->
           // This didn't work
            <!--  
                 <ng-include src="'views/Header*.html'"></ng-include>
            -->
        </div>

JS Code:

In $routeProvider:

            .when('/head',
            {
                templateUrl: 'views/Header.html', // how to handle this
                // This didn't work
                // templateUrl: 'views/Header*.html',
                controller: 'HeaderController'
            })  

Gulp Code:

var gulp = require('gulp'), 
    fileSort = require('gulp-angular-filesort'),
    cleanCss = require('gulp-clean-css'),
    rev = require('gulp-rev');

gulp.task('appFiles', function () {

var jsFiles = gulp.src('./src/**/*.js')
    .pipe(fileSort())
    .pipe(rev())
    .pipe(gulp.dest('./build'));

var cssFiles = gulp.src('./src/**/*.css')
    .pipe(cleanCss({debug: true}))
    .pipe(rev())
    .pipe(gulp.dest('./build' + '/Styles/CSS'));

var htmlFiles = gulp.src(['./src/**/*.html',  '!' + './src/index.html'])
    .pipe(rev())
    .pipe(gulp.dest('./build'));

var jsonFiles = gulp.src('./src +/**/*.json')
    .pipe(rev())
    .pipe(gulp.dest('./build'));

});
4

1 に答える 1