diff --git a/.gitignore b/.gitignore index 1793954a..77e4eb04 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ var/ *.egg-info/ .installed.cfg *.egg +node_modules/ # Continer extras .vagrant diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..38cefef3 --- /dev/null +++ b/gulpfile.js @@ -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' +]); diff --git a/package.json b/package.json new file mode 100644 index 00000000..d825eb14 --- /dev/null +++ b/package.json @@ -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" + } +}