Added gulpfile and dev dependencies

This commit is contained in:
Thomas Boerger 2016-12-29 19:10:14 +01:00
parent 9423d56bb2
commit a5ef19c6f9
No known key found for this signature in database
GPG Key ID: 5A388F55283960B6
2 changed files with 128 additions and 2 deletions

115
gulpfile.js Normal file
View File

@ -0,0 +1,115 @@
var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var clean = require('gulp-clean');
var include = require('gulp-include');
var uglify = require('gulp-uglify');
var cssDestination = './public/temp/css';
var jsDestination = './public/temp/js';
gulp.task('default', [
'build'
]);
gulp.task('build', [
'less-vendor',
'less-highlight',
'less-custom',
'scripts-vendor',
'scripts-highlight',
'scripts-custom'
]);
gulp.task('less-vendor', function () {
return gulp
.src('./public/assets/less/vendor.less')
.pipe(sourcemaps.init())
.pipe(less({
paths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(cssDestination));
});
gulp.task('less-highlight', function () {
return gulp
.src('./public/assets/less/highlight.less')
.pipe(sourcemaps.init())
.pipe(less({
paths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(cssDestination));
});
gulp.task('less-custom', function () {
return gulp
.src('./public/assets/less/index.less')
.pipe(sourcemaps.init())
.pipe(less({
paths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(cssDestination));
});
gulp.task('scripts-vendor', function () {
return gulp
.src('./public/assets/scripts/vendor.js')
.pipe(sourcemaps.init())
.pipe(include({
includePaths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(jsDestination));
});
gulp.task('scripts-highlight', function () {
return gulp
.src('./public/assets/scripts/highlight.js')
.pipe(sourcemaps.init())
.pipe(include({
includePaths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(jsDestination));
});
gulp.task('scripts-custom', function () {
return gulp
.src('./public/assets/scripts/index.js')
.pipe(sourcemaps.init())
.pipe(include({
includePaths: [
__dirname + '/node_modules'
]
})).on('error', console.log)
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(jsDestination));
});
gulp.task('clean', function () {
return gulp
.src([cssDestination, jsDestination])
.pipe(clean());
});
gulp.task('watch', function () {
return gulp
.watch('./public/assets/less/*.less', ['less-custom'])
.watch('./public/assets/scripts/*.js', ['scripts-custom']);
});

View File

@ -18,9 +18,20 @@
"email": "security@gitea.io"
},
"config": {},
"scripts": {},
"scripts": {
"build": "gulp build",
"clean": "gulp clean",
"watch": "gulp watch"
},
"main": "",
"devDependencies": {},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-include": "^2.3.1",
"gulp-less": "^3.3.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-uglify": "^2.0.0"
},
"dependencies": {
"@claviska/jquery-minicolors": "^2.2.4",
"@ryancavanaugh/jquery.are-you-sure": "0.0.14-alpha",