Updated deps and gulpfile to work with babel 6

This commit is contained in:
Tobias Reich 2015-12-08 10:06:00 +01:00
parent 5b97a295d5
commit 0e09fbdc67
3 changed files with 70 additions and 81 deletions

BIN
dist/main.js vendored

Binary file not shown.

View File

@ -1,13 +1,13 @@
var gulp = require('gulp'),
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
paths = {};
paths = {}
/* Error Handler -------------------------------- */
var catchError = function(err) {
console.log(err.toString());
this.emit('end');
console.log(err.toString())
this.emit('end')
}
@ -38,41 +38,38 @@ paths.view = {
gulp.task('view--js', function() {
var stream =
gulp.src(paths.view.js)
.pipe(plugins.concat('_view--javascript.js', {newLine: "\n"}))
.pipe(plugins.babel({ compact: true }))
.on('error', catchError)
.pipe(gulp.dest('../dist/'));
var babel = plugins.babel({
presets: ['es2015']
})
return stream;
return gulp.src(paths.view.js)
.pipe(plugins.concat('_view--javascript.js', {newLine: "\n"}))
.pipe(babel)
.on('error', catchError)
.pipe(gulp.dest('../dist/'))
});
})
gulp.task('view--scripts', ['view--js'], function() {
var stream =
gulp.src(paths.view.scripts)
.pipe(plugins.concat('view.js', {newLine: "\n"}))
.pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('../dist/'));
return gulp.src(paths.view.scripts)
.pipe(plugins.concat('view.js', {newLine: "\n"}))
.pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('../dist/'))
return stream;
});
})
gulp.task('view--svg', function() {
var stream =
gulp.src(paths.view.php)
.pipe(plugins.inject(gulp.src(paths.view.svg), {
starttag: '<!-- inject:svg -->',
transform: function(filePath, file) { return file.contents.toString('utf8') }
}))
.pipe(gulp.dest('../'));
return gulp.src(paths.view.php)
.pipe(plugins.inject(gulp.src(paths.view.svg), {
starttag: '<!-- inject:svg -->',
transform: function(filePath, file) { return file.contents.toString('utf8') }
}))
.pipe(gulp.dest('../'))
});
})
/* Main ----------------------------------------- */
@ -108,83 +105,74 @@ paths.main = {
gulp.task('main--js', function() {
var stream =
gulp.src(paths.main.js)
.pipe(plugins.concat('_main--javascript.js', {newLine: "\n"}))
.pipe(plugins.babel({ compact: true }))
.on('error', catchError)
.pipe(gulp.dest('../dist/'));
var babel = plugins.babel({
presets: ['es2015']
})
return stream;
return gulp.src(paths.main.js)
.pipe(plugins.concat('_main--javascript.js', {newLine: "\n"}))
.pipe(babel)
.on('error', catchError)
.pipe(gulp.dest('../dist/'))
});
})
gulp.task('main--scripts', ['main--js'], function() {
var stream =
gulp.src(paths.main.scripts)
.pipe(plugins.concat('main.js', {newLine: "\n"}))
.pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('../dist/'));
return gulp.src(paths.main.scripts)
.pipe(plugins.concat('main.js', {newLine: "\n"}))
.pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('../dist/'))
return stream;
});
})
gulp.task('main--styles', function() {
var stream =
gulp.src(paths.main.styles)
.pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.concat('main.css', {newLine: "\n"}))
.pipe(plugins.autoprefixer('last 4 versions', '> 5%'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('../dist/'));
return gulp.src(paths.main.styles)
.pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.concat('main.css', {newLine: "\n"}))
.pipe(plugins.autoprefixer('last 4 versions', '> 5%'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('../dist/'))
return stream;
});
})
gulp.task('main--svg', function() {
var stream =
gulp.src(paths.main.html)
.pipe(plugins.inject(gulp.src(paths.main.svg), {
starttag: '<!-- inject:svg -->',
transform: function(filePath, file) { return file.contents.toString('utf8') }
}))
.pipe(gulp.dest('../'));
return gulp.src(paths.main.html)
.pipe(plugins.inject(gulp.src(paths.main.svg), {
starttag: '<!-- inject:svg -->',
transform: function(filePath, file) { return file.contents.toString('utf8') }
}))
.pipe(gulp.dest('../'))
});
})
/* Clean ----------------------------------------- */
gulp.task('clean', function() {
var stream =
gulp.src('../dist/_*.*', { read: false })
.pipe(plugins.rimraf({ force: true }))
.on('error', catchError);
return gulp.src('../dist/_*.*', { read: false })
.pipe(plugins.rimraf({ force: true }))
.on('error', catchError)
return stream;
});
})
/* Tasks ----------------------------------------- */
gulp.task('default', ['view--svg', 'view--scripts', 'main--svg', 'main--scripts', 'main--styles'], function() {
gulp.start('clean');
gulp.start('clean')
});
})
gulp.task('watch', ['default'], function() {
gulp.watch(paths.view.js, ['view--scripts']);
gulp.watch(paths.view.js, ['view--scripts'])
gulp.watch(paths.main.js, ['main--scripts']);
gulp.watch(paths.main.scss, ['main--styles']);
gulp.watch(paths.main.js, ['main--scripts'])
gulp.watch(paths.main.scss, ['main--styles'])
});
})

View File

@ -10,15 +10,16 @@
"url": "https://github.com/electerious/Lychee.git"
},
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"basiccontext": "^3.5.0",
"basicmodal": "^3.1.7",
"basicmodal": "^3.3.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "3.1.0",
"gulp-babel": "^5.3.0",
"gulp-babel": "^6.1.1",
"gulp-concat": "^2.6.0",
"gulp-inject": "^3.0.0",
"gulp-load-plugins": "^1.1.0",
"gulp-minify-css": "^1.2.1",
"gulp-minify-css": "^1.2.2",
"gulp-rimraf": "^0.2.0",
"gulp-sass": "^2.1.0",
"gulp-uglify": "^1.5.1",