Skip to content

Commit

Permalink
more misc dev stuff (openemr#3261)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Mar 29, 2020
1 parent 2201da7 commit d34a151
Show file tree
Hide file tree
Showing 4 changed files with 742 additions and 1,758 deletions.
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ services:
ports:
- 8300:80
- 9300:443
- 3000:3000 # browsersync
- 3001:3001 # browsersync-admin
volumes:
- .:/openemr:ro
- .:/var/www/localhost/htdocs/openemr:rw
Expand Down
50 changes: 7 additions & 43 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

// modules
const browserSync = require('browser-sync');
const csso = require('gulp-csso');
const del = require('del');
const fs = require('fs');
Expand All @@ -12,7 +11,6 @@ const gulp = require('gulp');
const argv = require('minimist')(process.argv.slice(2));
const gulpif = require('gulp-if');
const prefix = require('gulp-autoprefixer');
const reload = browserSync.reload;
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
Expand All @@ -28,8 +26,6 @@ let config = {
// Command Line Arguments
dev: argv['dev'],
build: argv['b'],
syncOnly: argv['sync-only'],
proxy: argv['p'],
install: argv['i'],

// Source file locations
Expand Down Expand Up @@ -58,8 +54,6 @@ function clean(done) {
// Parses command line arguments
function ingest(done) {
if (config.dev && typeof config.dev !== "boolean") {
// allows for custom proxy to be passed into script
config.proxy = config.dev;
config.dev = true;
}
done();
Expand All @@ -81,9 +75,7 @@ function styles_style_portal() {
.pipe(gap.prependText(autoGeneratedHeader))
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}
// standard themes css compilation
function styles_style_uni() {
Expand All @@ -94,9 +86,7 @@ function styles_style_uni() {
.pipe(gap.prependText(autoGeneratedHeader))
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}

// color themes css compilation
Expand All @@ -108,9 +98,7 @@ function styles_style_color() {
.pipe(gap.prependText(autoGeneratedHeader))
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}

// rtl standard themes css compilation
Expand All @@ -125,9 +113,7 @@ function rtl_style_portal() {
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(rename({ prefix: "rtl_" }))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}

// rtl standard themes css compilation
Expand All @@ -142,9 +128,7 @@ function rtl_style_uni() {
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(rename({ prefix: "rtl_" }))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}

// rtl color themes css compilation
Expand All @@ -159,13 +143,11 @@ function rtl_style_color() {
.pipe(gulpif(!config.dev, csso()))
.pipe(gulpif(!config.dev, sourcemaps.write()))
.pipe(rename({ prefix: "rtl_" }))
.pipe(gulp.dest(config.dest.themes))
.pipe(gulpif(config.dev && config.build, gulp.dest(config.dest.themes)))
.pipe(gulpif(config.dev, reload({ stream: true })));
.pipe(gulp.dest(config.dest.themes));
}

// compile themes
const styles = gulp.parallel(styles_style_uni, styles_style_portal, styles_style_color, rtl_style_portal, rtl_style_uni, rtl_style_color);
const styles = gulp.parallel(styles_style_color, styles_style_uni, styles_style_portal, rtl_style_color, rtl_style_uni, rtl_style_portal);

// Copies (and distills, if possible) assets from node_modules to public/assets
function install(done) {
Expand Down Expand Up @@ -240,23 +222,7 @@ function watch() {
.pipe(gulp.dest(config.dest.themes));
}

function sync_only(done) {
browserSync.init({
proxy: "127.0.0.1:" + config.proxy,
open: false
});
done();
}

// Will start browser sync and/or watch changes to scss
// = Runs task(styles) first
function sync() {
if (config.proxy) {
browserSync.init({
proxy: "127.0.0.1:" + config.proxy
});
}

// copy all leftover root-level components to the theme directory
// hoping this is only temporary
return gulp.src(['interface/themes/*.{css,php}'])
Expand All @@ -272,8 +238,6 @@ exports.watch = watch;
// rare case where the user is running the watch task).
if (config.install) {
exports.default = gulp.series(install)
} else if (config.syncOnly && config.proxy) {
exports.default = gulp.parallel(sync_only, watch)
} else {
exports.default = gulp.series(clean, ingest, styles, sync);
}
Loading

0 comments on commit d34a151

Please sign in to comment.