Skip to content

Commit

Permalink
Upgrade to gulp 4
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrala committed Oct 6, 2019
1 parent 32bdc38 commit 4bc44b9
Show file tree
Hide file tree
Showing 4 changed files with 631 additions and 369 deletions.
66 changes: 26 additions & 40 deletions gulpfile.js
Expand Up @@ -68,19 +68,6 @@ gulp.task('jshint', function (cb) {
],cb);
});

gulp.task('jscs', function (cb) {
// Broken in new release...
return;
pump([
gulp.src(scripts.src),
plugins.jscs(),
plugins.jscs.reporter(),
plugins.jscs.reporter('fail')
], cb);
});

gulp.task('js', ['jshint', 'jscs', 'jslibs', 'jsdist']);

gulp.task('jsdist', function (cb) {
pump([
gulp.src(scripts.src),
Expand Down Expand Up @@ -110,25 +97,14 @@ gulp.task('jslibs', function (cb){
});

gulp.task('css', function (cb) {
pump([
return pump([
gulp.src(styles.src),
sass(),
plugins.csslint('src/.csslintrc'),
plugins.csslint.formatter(),
plugins.sourcemaps.init(),
plugins.replace(replacement.regexp, replacement.filter),
plugins.autoprefixer({
browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]
}),
plugins.autoprefixer(),
plugins.csscomb('src/.csscomb.json'),
plugins.rename(styles.name),
gulp.dest(styles.dest),
Expand All @@ -139,11 +115,11 @@ gulp.task('css', function (cb) {
], cb);
});

gulp.task('build-icons', function () {
gulp.task('build-icons', function (done) {
var iconfont = require('gulp-iconfont');
var consolidate = require('gulp-consolidate');

gulp.src(icons.src)
return gulp.src(icons.src)
.pipe(iconfont({
fontName: 'context-menu-icons',
fontHeight: 1024,
Expand Down Expand Up @@ -171,28 +147,38 @@ gulp.task('build-icons', function () {
.pipe(gulp.dest('src/sass')); // set path to export your sample HTML
})
.pipe(gulp.dest(icons.fontOutputPath));

});

/**
* Update paths in integration tests that are generated by the documentation
* generator so they use the local source.
*/
gulp.task('integration-test-paths', function(){


return gulp.src('test/integration/html/*.html').
pipe(plugins.replace('https\:\/\/swisnl\.github\.io\/jQuery-contextMenu\/dist\/jquery\.ui\.position\.min\.js', '\.\.\/\.\.\/\.\.\/dist\/jquery\.ui\.position\.min\.js')).
pipe(plugins.replace('https\:\/\/swisnl\.github\.io\/jQuery\-contextMenu\/dist\/', '\.\.\/\.\.\/\.\.\/src\/')).
pipe(plugins.replace('\/src\/jquery.contextMenu.css', '\/dist\/jquery.contextMenu.css')).
pipe(gulp.dest('test/integration/html/'));
pipe(plugins.replace('https\:\/\/swisnl\.github\.io\/jQuery-contextMenu\/dist\/jquery\.ui\.position\.min\.js', '\.\.\/\.\.\/\.\.\/dist\/jquery\.ui\.position\.min\.js')).
pipe(plugins.replace('https\:\/\/swisnl\.github\.io\/jQuery\-contextMenu\/dist\/', '\.\.\/\.\.\/\.\.\/src\/')).
pipe(plugins.replace('\/src\/jquery.contextMenu.css', '\/dist\/jquery.contextMenu.css')).
pipe(gulp.dest('test/integration/html/'));
});


gulp.task('watch', ['js', 'css'], function () {
gulp.watch(scripts.src, ['js']);
gulp.watch(styles.all, ['css']);
});

gulp.task('build', ['build-icons', 'css', 'js', 'integration-test-paths']);

gulp.task('default', ['watch']);
gulp.task('js', gulp.series('jshint', 'jsdist', (done) => {
done();
}));


gulp.task('watch', gulp.parallel('js', 'css', function (done) {
gulp.watch(scripts.src,gulp.series('js'));
gulp.watch(styles.all, gulp.series('css'));
done();
}));
gulp.task('build', gulp.series('build-icons', 'css', 'js', 'integration-test-paths', (done) => {
done();
}));

gulp.task('default', gulp.series('watch', (done) => {
done();
}));
20 changes: 15 additions & 5 deletions package.json
Expand Up @@ -12,9 +12,9 @@
},
"devDependencies": {
"doctoc": "^1.3.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^5.0.0",
"gulp-clean-css": "^3.9.3",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-clean-css": "^4.2.0",
"gulp-concat": "~2.6.0",
"gulp-consolidate": "^0.2.0",
"gulp-csscomb": "^3.0.8",
Expand All @@ -25,7 +25,7 @@
"gulp-iconfont": "^10.0.1",
"gulp-jscs": "^4.1.0",
"gulp-jshint": "^2.1.0",
"gulp-load-plugins": "^1.3.0",
"gulp-load-plugins": "^2.0.1",
"gulp-qunit": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^1.0.0",
Expand Down Expand Up @@ -90,5 +90,15 @@
"test-unit": "./node_modules/karma/bin/karma start",
"test-sauce": "./node_modules/karma/bin/karma start karma-saucelabs.conf.js",
"test-accept": "./node_modules/.bin/wdio wdio.conf.js"
}
},
"browserslist": [
"Android 2.3",
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
]
}
2 changes: 1 addition & 1 deletion src/sass/icons/_variables.scss
@@ -1,5 +1,5 @@
// DON'T MANUALLY EDIT THIS FILE; run `gulp build-icons` instead.
$context-menu-icons-cachebust: "1zyug";
$context-menu-icons-cachebust: "2fybw";
$context-menu-icons: (
add: "EA01",
copy: "EA02",
Expand Down

0 comments on commit 4bc44b9

Please sign in to comment.