Added gulp to automatically build admin css

pull/1129/head
Luca Di Leo 2022-01-28 10:41:18 -08:00
rodzic 147b7b4a1c
commit 8a25325bb1
4 zmienionych plików z 54 dodań i 1 usunięć

Wyświetl plik

@ -22,6 +22,7 @@ RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends wget cu
# Setup cron
ln -s /webodm/nginx/crontab /var/spool/cron/crontabs/root && chmod 0644 /webodm/nginx/crontab && service cron start && chmod +x /webodm/nginx/letsencrypt-autogen.sh && \
/webodm/nodeodm/setup.sh && /webodm/nodeodm/cleanup.sh && cd /webodm && \
npm install --quiet -g gulp-cli && \
npm install --quiet -g webpack@4.16.5 && npm install --quiet -g webpack-cli@4.2.0 && npm install --quiet && webpack --mode production && \
echo "UTC" > /etc/timezone && \
python manage.py collectstatic --noinput && \

Wyświetl plik

@ -0,0 +1,36 @@
// Sass configuration
var gulp = require("gulp"),
sass = require("gulp-sass"),
postcss = require("gulp-postcss"),
autoprefixer = require("autoprefixer"),
cssnano = require("cssnano"),
sourcemaps = require("gulp-sourcemaps");
function watch() {
style();
gulp.watch('css/*.scss', style);
}
function style() {
return (
gulp
.src('css/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.on("error", sass.logError)
// Aggiungiamo i prefissi dove serve e minifichiamo
.pipe(postcss([autoprefixer(), cssnano()]))
// Le sourcemaps non fanno mai male
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(function(f) {
return "./css";
}))
);
}
exports.watch = watch;
exports.style = style;

Wyświetl plik

@ -68,6 +68,13 @@
"url-loader": "^0.5.7",
"webpack": "^4.16.2",
"webpack-bundle-tracker": "0.0.93",
"webpack-livereload-plugin": "^2.1.1"
"webpack-livereload-plugin": "^2.1.1",
"autoprefixer": "^9.8.4",
"cssnano": "^4.1.10",
"gulp": "^4.0.2",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5",
"node-sass": "^5.0.0"
}
}

Wyświetl plik

@ -43,8 +43,10 @@ if [ "$1" = "--setup-devenv" ] || [ "$2" = "--setup-devenv" ]; then
echo Setup npm dependencies...
npm install
cd nodeodm/external/NodeODM
npm install
cd /webodm
echo Setup pip requirements...
@ -53,6 +55,13 @@ if [ "$1" = "--setup-devenv" ] || [ "$2" = "--setup-devenv" ]; then
echo Build translations...
python manage.py translate build --safe
echo Setup gulp watch...
cd app/static/admin
npm rebuild node-sass
gulp watch &
cd /webodm
echo Setup webpack watch...
webpack --watch &
fi