Add basic gulp build system

This commit is contained in:
Tom Price
2017-05-09 13:18:17 +01:00
parent 9b7c84cf08
commit 41196b6447
3 changed files with 87 additions and 0 deletions

1
.gitignore vendored
View File

@@ -25,6 +25,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
node_modules/
# Continer extras
.vagrant

68
gulpfile.js Normal file
View File

@@ -0,0 +1,68 @@
'use strict';
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var batch = require('gulp-batch');
var watch = require('gulp-watch');
var APPS = [
'RIGS'
];
var SASS_INCLUDE_PATHS = APPS.map(function (elem) {
return './' + elem + '/static/scss'
}).concat(['./node_modules']);
function css(opts) {
return gulp.src('PyRIGS/static/scss/screen.scss')
.pipe(sourcemaps.init())
.pipe(sass(
{includePaths: SASS_INCLUDE_PATHS}
)).on('error', sass.logError)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'));
}
gulp.task('css', function () {
return css()
});
gulp.task('watch', function () {
batch(function (events, done) {
gulp.start('css', done);
});
watch(SASS_INCLUDE_PATHS.concat(['PyRIGS/static/scss/screen.scss']), batch(function (events, done) {
gulp.start('css', done);
}));
});
// JS
var JS_LIBS = [
'./node_modules/jquery/dist/jquery.js',
'./node_modules/tether/dist/js/tether.js',
'./node_modules/bootstrap/dist/js/bootstrap.js'
];
function js_lib() {
return gulp.src(JS_LIBS)
.pipe(sourcemaps.init())
.pipe(concat('lib.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/js'));
}
gulp.task('js_lib', function () {
return js_lib()
});
// Frontend tasks
gulp.task('frontend', [
'css',
'js_lib'
]);

18
package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "pyrigs",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/nottinghamtec/PyRIGS.git"
},
"private": true,
"devDependencies": {
"gulp": "^3.9.1",
"gulp-batch": "^1.0.5",
"gulp-concat": "^2.6.1",
"gulp-less": "^3.3.0",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-watch": "^4.3.11"
}
}