Mercurial > piecrust2
annotate gulpfile.js @ 1195:ae9387338db1 draft default tip
admin: add option to publish immediately
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 30 Dec 2022 16:48:04 -0800 |
parents | bfa470063ee2 |
children |
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: [ |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
20 'node_modules/bootstrap/scss', |
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
21 'node_modules/open-iconic/font/css']})) |
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 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
28 // Javascript |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
29 gulp.task('js', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
30 return gulp.src([ |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
31 'node_modules/jquery/dist/jquery.min.js', |
1189
bfa470063ee2
cm: Update node packages.
Ludovic Chabant <ludovic@chabant.com>
parents:
1171
diff
changeset
|
32 'node_modules/timeago/jquery.timeago.js', |
bfa470063ee2
cm: Update node packages.
Ludovic Chabant <ludovic@chabant.com>
parents:
1171
diff
changeset
|
33 'node_modules/popper.js/dist/umd/popper.min.js', |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
34 'node_modules/bootstrap/dist/js/bootstrap.min.js', |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
35 '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
|
36 ]) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
37 .pipe(sourcemaps.init()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
38 .pipe(concat('foodtruck.js')) |
1189
bfa470063ee2
cm: Update node packages.
Ludovic Chabant <ludovic@chabant.com>
parents:
1171
diff
changeset
|
39 .pipe(uglify()) |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
40 .pipe(sourcemaps.write()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
41 .pipe(rename({suffix: '.min'})) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
42 .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
|
43 }); |
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 // Fonts/images |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
46 gulp.task('fonts', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
47 return gulp.src([ |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
48 'node_modules/open-iconic/font/fonts/*' |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
49 ]) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
50 .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
|
51 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
52 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
53 gulp.task('images', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
54 return gulp.src([ |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
55 'piecrust/admin/assets/img/*' |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
56 ]) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
57 .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
|
58 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
59 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
60 // Launch tasks |
1171
7eb58b5748eb
cm: Update gulp/npm stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
1069
diff
changeset
|
61 gulp.task('default', gulp.parallel(['sass', 'js', 'fonts', 'images'])); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
62 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
63 gulp.task('watch', function() { |
1171
7eb58b5748eb
cm: Update gulp/npm stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
1069
diff
changeset
|
64 gulp.watch('piecrust/admin/assets/sass/**/*.scss', gulp.series('sass')); |
7eb58b5748eb
cm: Update gulp/npm stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
1069
diff
changeset
|
65 gulp.watch('piecrust/admin/assets/js/**/*.js', gulp.series('js')); |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
66 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
67 |