-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
114 lines (95 loc) · 2.85 KB
/
gulpfile.js
File metadata and controls
114 lines (95 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var gulp = require('gulp'),
fs = require('fs'),
plugins = require('gulp-load-plugins')();
var basepath = './web/assets/';
gulp.task('js', function() {
return gulp.src(basepath + 'src/js/main.js')
.pipe(plugins.concat('scripts.min.js'))
.pipe(plugins.uglify())
.pipe(gulp.dest(basepath + 'dist'));
});
gulp.task('p5js', function () {
return gulp.src([
basepath + 'vendor/p5.js/lib/p5.min.js',
basepath + 'src/js/lines.js'
])
.pipe(plugins.concat('lines.min.js'))
.pipe(plugins.uglify())
.pipe(gulp.dest(basepath + 'dist'));
});
gulp.task('css', function () {
return gulp.src(basepath + 'src/less/main.less')
.pipe(plugins.less())
.pipe(plugins.rename('styles.css'))
.pipe(gulp.dest(basepath + 'dist'))
.pipe(plugins.rename('styles.min.css'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest(basepath + 'dist'))
.pipe(plugins.livereload());
});
gulp.task('watch', function () {
plugins.livereload.listen();
gulp.watch('web/assets/src/**/*.less', ['css']);
gulp.watch('web/assets/src/**/*.js', ['js']);
gulp.watch('web/**/*.html').on('change', plugins.livereload.changed);
gulp.watch('web/assets/dist/**').on('change', plugins.livereload.changed);
});
gulp.task('watch-p5js', function() {
plugins.livereload.listen();
gulp.watch('web/assets/src/js/lines.js', ['p5js']);
gulp.watch('web/assets/dist/**').on('change', plugins.livereload.changed);
});
gulp.task('default', ['js', 'css', 'watch']);
gulp.task('build', ['js', 'css']);
// FAVICONS
var FAVICON_DATA_FILE = 'faviconData.json';
var FAVICON_COLOR = '#FFFFFF';
gulp.task('generate-favicon', function(done) {
plugins.realFavicon.generateFavicon({
masterPicture: './web/assets/src/favicon/favicon.png',
dest: './web/',
iconsPath: '/',
design: {
ios: {
pictureAspect: 'noChange'
},
desktopBrowser: {},
windows: {
pictureAspect: 'noChange',
backgroundColor: FAVICON_COLOR,
onConflict: 'override'
},
androidChrome: {
pictureAspect: 'noChange',
themeColor: '#ffffff',
manifest: {
name: 'Paperpixel',
display: 'browser',
orientation: 'notSet',
onConflict: 'override'
}
},
safariPinnedTab: {
pictureAspect: 'blackAndWhite',
threshold: 46.875,
themeColor: FAVICON_COLOR
}
},
settings: {
scalingAlgorithm: 'Lanczos',
errorOnImageTooSmall: false
},
versioning: {
paramName: 'v',
paramValue: '9BBlKGlkj3'
},
markupFile: FAVICON_DATA_FILE
}, function() {
done();
});
});
gulp.task('inject-favicon-markups', function() {
gulp.src([ './web/index.html', './web/404.html' ])
.pipe(plugins.realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
.pipe(gulp.dest('./web'));
});