Skip to content

Commit 234f40a

Browse files
committed
gulp4 WIP
1 parent c6a45df commit 234f40a

36 files changed

+589
-1214
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ node_modules
3131

3232
# Other
3333
npm-debug.log
34-
.idea
34+
.idea
35+
generators/app/templates/gulp_old/

generators/app/prompts.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ module.exports = [
1616
name: 'Nunjucks',
1717
value: 'nunjucks'
1818
},
19-
{
20-
name: 'Swig',
21-
value: 'swig'
22-
},
23-
{
24-
name: 'Jade',
25-
value: 'jade'
26-
},
19+
// {
20+
// name: 'Swig',
21+
// value: 'swig'
22+
// },
23+
// {
24+
// name: 'Jade',
25+
// value: 'jade'
26+
// },
2727
{
2828
name: 'Pug',
2929
value: 'pug'
3030
},
31-
{
32-
name: 'No templates, just pure html',
33-
value: 'html'
34-
}
31+
// {
32+
// name: 'No templates, just pure html',
33+
// value: 'html'
34+
// }
3535
],
3636
default: 0
3737
},
@@ -44,28 +44,28 @@ module.exports = [
4444
name: 'Sass + PostCSS',
4545
value: 'sass'
4646
},
47-
{
48-
name: 'PostCSS (with SugarSS and Stylelint)',
49-
value: 'postcss'
50-
}
47+
// {
48+
// name: 'PostCSS (with SugarSS and Stylelint)',
49+
// value: 'postcss'
50+
// }
5151
],
5252
default: 0
5353
},
54-
{
55-
type: 'list',
56-
name: 'bundler',
57-
message: 'Choose js modules bundler',
58-
choices: [
59-
{
60-
name: 'Webpack',
61-
value: 'webpack'
62-
},
63-
{
64-
name: 'I will merge files manually.',
65-
value: 'manually'
66-
}
67-
]
68-
},
54+
// {
55+
// type: 'list',
56+
// name: 'bundler',
57+
// message: 'Choose js modules bundler',
58+
// choices: [
59+
// {
60+
// name: 'Webpack',
61+
// value: 'webpack'
62+
// },
63+
// {
64+
// name: 'I will merge files manually.',
65+
// value: 'manually'
66+
// }
67+
// ]
68+
// },
6969
{
7070
type: 'checkbox',
7171
name: 'sprites',
@@ -76,16 +76,16 @@ module.exports = [
7676
value: 'svg',
7777
checked: true
7878
},
79-
{
80-
name: 'Iconfonts',
81-
value: 'iconfont',
82-
checked: false
83-
},
84-
{
85-
name: 'PNG sprites',
86-
value: 'png',
87-
checked: false
88-
}
79+
// {
80+
// name: 'Iconfonts',
81+
// value: 'iconfont',
82+
// checked: false
83+
// },
84+
// {
85+
// name: 'PNG sprites',
86+
// value: 'png',
87+
// checked: false
88+
// }
8989
]
9090
},
9191
{

generators/app/templates/gulp/config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var util = require('gulp-util');
1+
import util from 'gulp-util';
22

3-
var production = util.env.production || util.env.prod || false;
4-
var destPath = 'build';
3+
const production = util.env.production || util.env.prod || false;
4+
const destPath = 'build';
55

6-
var config = {
6+
const config = {
77
env : 'development',
88
production: production,
99

@@ -41,16 +41,16 @@ var config = {
4141
},
4242

4343
setEnv: function(env) {
44-
if (typeof env !== 'string') return;
45-
this.env = env;
46-
this.production = env === 'production';
47-
process.env.NODE_ENV = env;
44+
if (typeof env !== 'string') return;
45+
this.env = env;
46+
this.production = env === 'production';
47+
process.env.NODE_ENV = env;
4848
},
4949

5050
logEnv: function() {
5151
util.log(
52-
'Environment:',
53-
util.colors.white.bgRed(' ' + process.env.NODE_ENV + ' ')
52+
'Environment:',
53+
util.colors.white.bgRed(' ' + process.env.NODE_ENV + ' ')
5454
);
5555
},
5656

generators/app/templates/gulp/tasks/browserify.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

generators/app/templates/gulp/tasks/build.js

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
var gulp = require('gulp');
2-
var del = require('del');
3-
var util = require('gulp-util');
4-
var config = require('../config');
1+
import del from 'del';
2+
import util from 'gulp-util';
3+
import config from '../config';
54

6-
gulp.task('clean', function(cb) {
5+
const build = () => {
6+
return function () {
77
return del([
8-
config.dest.root
9-
]).then(function(paths) {
10-
util.log('Deleted:', util.colors.magenta(paths.join('\n')));
11-
});
12-
});
8+
config.dest.root
9+
])
10+
.then(paths => util.log('Deleted:', util.colors.magenta(paths.join('\n'))))
11+
};
12+
};
13+
14+
module.exports.build = build;
Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,40 @@
1-
var gulp = require('gulp');
2-
var config = require('../config.js');
1+
import gulp from 'gulp';
2+
import config from '../config.js';
3+
// import imagemin from 'gulp-imagemin';
34

4-
gulp.task('copy:fonts', function () {
5-
return gulp
6-
.src(config.src.fonts + '/*.{ttf,eot,woff,woff2}')
7-
.pipe(gulp.dest(config.dest.fonts));
8-
});
5+
gulp.task('copy:img', () => gulp
6+
.src([
7+
config.src.img + '/**/*.{jpg,png,jpeg,svg,gif}',
8+
'!' + config.src.img + '/svgo/**/*.*'
9+
])
10+
// .pipe(imagemin([], {
11+
// verbose: true
12+
// }))
13+
.pipe(gulp.dest(config.dest.img))
14+
);
915

10-
gulp.task('copy:data', function () {
11-
return gulp
12-
.src(config.src.data + '/**/*.*')
13-
.pipe(gulp.dest(config.dest.data));
14-
});
16+
gulp.task('copy:fonts', () => gulp
17+
.src(config.src.fonts + '/*.{ttf,eot,woff,woff2}')
18+
.pipe(gulp.dest(config.dest.fonts))
19+
);
1520

16-
gulp.task('copy:lib', function () {
17-
return gulp
18-
.src(config.src.lib + '/**/*.*')
19-
.pipe(gulp.dest(config.dest.lib));
20-
});
21+
gulp.task('copy:data', () => gulp
22+
.src(config.src.data + '/**/*.*')
23+
.pipe(gulp.dest(config.dest.data))
24+
);
2125

22-
gulp.task('copy:rootfiles', function () {
23-
return gulp
24-
.src(config.src.root + '/*.*')
25-
.pipe(gulp.dest(config.dest.root));
26-
});
26+
gulp.task('copy:lib', () => gulp
27+
.src(config.src.lib + '/**/*.*')
28+
.pipe(gulp.dest(config.dest.lib))
29+
);
2730

28-
gulp.task('copy:img', function () {
29-
return gulp
30-
.src([
31-
config.src.img + '/**/*.{jpg,png,jpeg,svg,gif}',
32-
'!' + config.src.img + '/svgo/**/*.*'
33-
])
34-
.pipe(gulp.dest(config.dest.img));
35-
});
31+
gulp.task('copy:rootfiles', () => gulp
32+
.src(config.src.root + '/*.*')
33+
.pipe(gulp.dest(config.dest.root))
34+
);
3635

37-
gulp.task('copy', [
38-
'copy:img',
39-
// 'copy:rootfiles',
40-
// 'copy:lib',
41-
// 'copy:data',
42-
'copy:fonts'
43-
]);
44-
gulp.task('copy:watch', function () {
45-
gulp.watch(config.src.img + '/*', ['copy']);
46-
});
36+
const build = gulp => gulp.series('copy:img', 'copy:fonts');
37+
const watch = gulp => () => gulp.watch(config.src.img + '/*', gulp.parallel('copy:img', 'copy:fonts'));
38+
39+
module.exports.build = build;
40+
module.exports.watch = watch;
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
var gulp = require('gulp');
2-
var runSequence = require('run-sequence');
3-
var config = require('../config');
1+
import gulp from 'gulp';
2+
import runSequence from 'run-sequence';
43

5-
gulp.task('default', function(cb) {
6-
runSequence(
7-
'build:dev',
8-
'watch',
9-
'server',
10-
cb
11-
);
12-
});
4+
gulp.task('default', cb => runSequence(
5+
'build:dev',
6+
'watch',
7+
'server',
8+
cb
9+
)
10+
);

0 commit comments

Comments
 (0)