Mercurial > piecrust2
annotate gulpfile.js @ 1051:971b4d67e82a
serve: Fix problems with assets disappearing between servings.
When an asset file changes, its source's pipeline is re-run. But that created
a bake record that only had that pipeline's output, so the other outputs were
incorrectly considered empty and therefore any stray files were removed. Now we
copy over bake records for the pipelines we don't run.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 26 Jan 2018 18:05:02 -0800 |
parents | 4d0f80b2ba7f |
children | dff873f11541 |
rev | line source |
---|---|
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 'use strict'; |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 var gulp = require('gulp'), |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 util = require('gulp-util'), |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 sass = require('gulp-sass'), |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 sourcemaps = require('gulp-sourcemaps'), |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 rename = require('gulp-rename'), |
646
87267392a5c1
cm: Update node module versions.
Ludovic Chabant <ludovic@chabant.com>
parents:
616
diff
changeset
|
8 cssnano = require('gulp-cssnano'), |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 concat = require('gulp-concat'), |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 uglify = require('gulp-uglify'); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 // Stylesheets |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 gulp.task('sass', function() { |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
14 return gulp.src('piecrust/admin/assets/sass/**/*.scss') |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
15 //.pipe(sourcemaps.init()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 .pipe(sass({ |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
17 errLogToConsole: true, |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
18 outputStyle: 'compressed', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
19 includePaths: [ |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
20 'bower_components/bootstrap-sass/assets/stylesheets', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
21 'bower_components/Ionicons/scss']})) |
646
87267392a5c1
cm: Update node module versions.
Ludovic Chabant <ludovic@chabant.com>
parents:
616
diff
changeset
|
22 .pipe(cssnano()) |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
23 //.pipe(sourcemaps.write()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
24 .pipe(rename({suffix: '.min'})) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
25 .pipe(gulp.dest('piecrust/admin/static/css')); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
26 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
27 gulp.task('sass:watch', function() { |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
28 return gulp.watch('piecrust/admin/assets/sass/**/*.scss', ['sass']); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
29 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
30 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
31 // Javascript |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
32 gulp.task('js', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
33 return gulp.src([ |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
34 'bower_components/jquery/dist/jquery.js', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
35 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/alert.js', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
36 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/button.js', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
37 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
38 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js', |
605 | 39 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/modal.js', |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
40 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
41 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/transition.js', |
657
c1a94e1beb9d
admin: Show a more classic blog post listing in FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
646
diff
changeset
|
42 'bower_components/jquery-timeago/jquery.timeago.js', |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
43 'piecrust/admin/assets/js/**/*.js' |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
44 ]) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
45 .pipe(sourcemaps.init()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
46 .pipe(concat('foodtruck.js')) |
646
87267392a5c1
cm: Update node module versions.
Ludovic Chabant <ludovic@chabant.com>
parents:
616
diff
changeset
|
47 //.pipe(uglify()) |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
48 .pipe(sourcemaps.write()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
49 .pipe(rename({suffix: '.min'})) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
50 .pipe(gulp.dest('piecrust/admin/static/js')); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
51 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
52 gulp.task('js:watch', function() { |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
53 return gulp.watch('piecrust/admin/assets/js/**/*.js', ['js']); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
54 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
55 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
56 // Fonts/images |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
57 gulp.task('fonts', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
58 return gulp.src([ |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
59 'bower_components/bootstrap-sass/assets/fonts/bootstrap/*', |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
60 'bower_components/Ionicons/fonts/*' |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
61 ]) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
62 .pipe(gulp.dest('piecrust/admin/static/fonts')); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
63 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
64 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
65 gulp.task('images', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
66 return gulp.src([ |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
67 'bower_components/bootstrap-sass/assets/images/*', |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
68 'piecrust/admin/assets/img/*' |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
69 ]) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
70 .pipe(gulp.dest('piecrust/admin/static/img')); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
71 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
72 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
73 // Launch tasks |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
74 gulp.task('default', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
75 gulp.start(['sass', 'js', 'fonts', 'images']); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
76 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
77 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
78 gulp.task('watch', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
79 gulp.start(['sass:watch', 'js:watch']); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
80 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
81 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
82 |