Add gulp template cache to improve performance

pull/3/head
Vladimir Lugovsky 9 years ago
parent 3438324841
commit f06f1f9b3e

@ -9,6 +9,8 @@ var imagemin = require('gulp-imagemin');
var stripDebug = require('gulp-strip-debug');
var uglify = require('gulp-uglify');
var eventStream = require('event-stream');
var templateCache = require('gulp-angular-templatecache');
var minifyHTML = require('gulp-minify-html');
gulp.task("minify-404-css", function () {
var vendorFiles = gulp.src("./src/assets/css/lib/bootstrap.min.css");
@ -88,12 +90,19 @@ gulp.task('font', function () {
gulp.src(fontSrc).pipe(gulp.dest(fontDst));
});
gulp.task('templateCache', function() {
return gulp.src('src/app/**/*.html')
.pipe(minifyHTML({ conditionals: true, spare: true }))
.pipe(templateCache({ root: '/app/', module: 'BlurAdmin' }))
.pipe(gulp.dest('src/release/js'));
});
gulp.task("watch", function () {
gulp.watch(["./src/app/**/*.css", "./src/assets/**/*.css", "./**/*.scss "], ["minify-css"]);
gulp.watch(imgSrc, ["imagemin"]);
gulp.watch(["./src/app/**/*.js", "./src/assets/**/*.js"], ["js"]);
});
gulp.task("init", ["minify-css", "imagemin", "js", "font"]);
gulp.task("init", ["minify-css", "imagemin", "js", "font", 'templateCache']);
gulp.task('default', ['init']);

@ -4,11 +4,13 @@
"devDependencies": {
"event-stream": "^3.3.1",
"gulp": "^3.9.0",
"gulp-angular-templatecache": "^1.7.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-changed": "^1.3.0",
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^2.3.0",
"gulp-minify-css": "^1.2.1",
"gulp-minify-html": "^1.0.4",
"gulp-sass": "^2.0.4",
"gulp-strip-debug": "^1.0.2",
"gulp-uglify": "^1.4.0"

@ -60,6 +60,7 @@
<script src="release/js/lib.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="release/js/bundle.min.js"></script>
<script src="release/js/templates.js"></script>
</body>
</html>
Loading…
Cancel
Save