mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-20 11:54:23 +01:00
Add angular template cache to prevent XHR requests to fetch templates
This commit is contained in:
parent
c68b007ed7
commit
d0e1ef7af8
4 changed files with 24 additions and 1 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
public static function styleIncludes($area = 'app') {
|
public static function styleIncludes($area = 'app') {
|
||||||
if (!Config::get("app.debug"))
|
if (!Config::get("app.debug"))
|
||||||
return '<script>document.write(\'<link rel="stylesheet" href="build/styles/' . $area . '.css?' . filemtime("build/styles/" . $area . ".css") . ' />"\');</script>';
|
return '<script>document.write(\'<link rel="stylesheet" href="build/styles/' . $area . '.css?' . filemtime("build/styles/" . $area . ".css") . '" />\');</script>';
|
||||||
|
|
||||||
$styles = self::mergeGlobs(self::getStylesForArea($area));
|
$styles = self::mergeGlobs(self::getStylesForArea($area));
|
||||||
$retVal = "";
|
$retVal = "";
|
||||||
|
|
|
@ -122,6 +122,10 @@
|
||||||
|
|
||||||
{{ Assets::scriptIncludes() }}
|
{{ Assets::scriptIncludes() }}
|
||||||
|
|
||||||
|
@if (!Config::get("app.debug"))
|
||||||
|
<script src="/build/scripts/templates.js"></script>
|
||||||
|
@endif
|
||||||
|
|
||||||
@yield('app_scripts')
|
@yield('app_scripts')
|
||||||
|
|
||||||
@endsection
|
@endsection
|
18
gulpfile.js
18
gulpfile.js
|
@ -149,6 +149,24 @@ gulp.task("styles-embed", function() {
|
||||||
.pipe(gulp.dest("public/build/styles"));
|
.pipe(gulp.dest("public/build/styles"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('copy:templates', function() {
|
||||||
|
gulp.src([
|
||||||
|
'public/templates/**/*.html'
|
||||||
|
])
|
||||||
|
.pipe(plug.angularTemplatecache({
|
||||||
|
module: "ponyfm",
|
||||||
|
root: "/templates"
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('public/build/scripts'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('build', [
|
||||||
|
'scripts-app',
|
||||||
|
'styles-app',
|
||||||
|
'scripts-embed',
|
||||||
|
'styles-embed',
|
||||||
|
]);
|
||||||
|
|
||||||
gulp.task("watch", function() {
|
gulp.task("watch", function() {
|
||||||
plug.livereload.listen();
|
plug.livereload.listen();
|
||||||
gulp.watch("app/scripts/**/*.{coffee,js}", ["scripts-app"]);
|
gulp.watch("app/scripts/**/*.{coffee,js}", ["scripts-app"]);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.8.11",
|
"gulp": "^3.8.11",
|
||||||
|
"gulp-angular-templatecache": "^1.6.0",
|
||||||
"gulp-autoprefixer": "^2.2.0",
|
"gulp-autoprefixer": "^2.2.0",
|
||||||
"gulp-cached": "^1.0.4",
|
"gulp-cached": "^1.0.4",
|
||||||
"gulp-coffee": "^2.3.1",
|
"gulp-coffee": "^2.3.1",
|
||||||
|
|
Loading…
Reference in a new issue