Mercurial > piecrust2
annotate gulpfile.js @ 1134:986ecdaa2a36
url: New `url` command to get the URL of a page from its path.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 23 Apr 2018 21:37:27 -0700 |
parents | dff873f11541 |
children | 7eb58b5748eb |
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 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([ |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
34 'node_modules/jquery/dist/jquery.min.js', |
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
35 'node_modules/bootstrap/dist/js/bootstrap.min.js', |
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
36 'node_modules/timeago/jquery.timeago.js', |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
37 '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
|
38 ]) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
39 .pipe(sourcemaps.init()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
40 .pipe(concat('foodtruck.js')) |
646
87267392a5c1
cm: Update node module versions.
Ludovic Chabant <ludovic@chabant.com>
parents:
616
diff
changeset
|
41 //.pipe(uglify()) |
603
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
42 .pipe(sourcemaps.write()) |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
43 .pipe(rename({suffix: '.min'})) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
44 .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
|
45 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
46 gulp.task('js:watch', function() { |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
47 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
|
48 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
49 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
50 // Fonts/images |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
51 gulp.task('fonts', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
52 return gulp.src([ |
1069
dff873f11541
admin: Upgrade Bootstrap, switch icons to Open-Iconic, remove Bower.
Ludovic Chabant <ludovic@chabant.com>
parents:
807
diff
changeset
|
53 '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
|
54 ]) |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
55 .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
|
56 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
57 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
58 gulp.task('images', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
59 return gulp.src([ |
807
4d0f80b2ba7f
cm: Fix `gulpfile` for FoodTruck.
Ludovic Chabant <ludovic@chabant.com>
parents:
657
diff
changeset
|
60 'piecrust/admin/assets/img/*' |
603
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/img')); |
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 // Launch tasks |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
66 gulp.task('default', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
67 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
|
68 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
69 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
70 gulp.task('watch', function() { |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
71 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
|
72 }); |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
73 |
7e4e567377cd
cm: Put Bower/Gulp/etc. stuff all at the root.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
74 |