Remove Gulp and use npm scripts instead

This commit is contained in:
Giuseppe Criscione 2020-03-14 17:07:49 +01:00
parent a79a2efd22
commit 60a3db50c7
6 changed files with 20 additions and 24191 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
/* eslint-env node */
var gulp = require('gulp');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
var rollup = require('rollup');
var resolve = require('@rollup/plugin-node-resolve');
var commonjs = require('@rollup/plugin-commonjs');
var uglify = require('gulp-uglify');
gulp.task('css', function () {
return gulp.src('./assets/scss/admin.scss')
.pipe(sass())
.pipe(gulp.dest('./assets/css'))
.pipe(rename('admin.min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest('./assets/css'));
});
gulp.task('js-rollup', function () {
return rollup.rollup({
input: './assets/js/src/main.js',
plugins: [resolve(), commonjs()]
}).then(function (bundle) {
return bundle.write({
file: './assets/js/app.js',
format: 'iife',
name: 'Formwork'
});
});
});
gulp.task('js-minify', function () {
return gulp.src('./assets/js/app.js')
.pipe(rename('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./assets/js'));
});
gulp.task('js', gulp.series('js-rollup', 'js-minify'));
gulp.task('default', gulp.parallel('css', 'js'));

3104
admin/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,18 +10,19 @@
"bugs": {
"url": "https://github.com/getformwork/formwork/issues"
},
"scripts": {
"build": "npm run build:css && npm run build:js",
"build:css": "node-sass ./assets/scss/admin.scss > ./assets/css/admin.css && node-sass ./assets/scss/admin.scss --output-style compressed > ./assets/css/admin.min.css",
"build:js": "rollup -c && uglifyjs assets/js/app.min.js -c -m -o assets/js/app.min.js --timings",
"watch:css": "onchange 'assets/scss/**/*.scss' -- npm run build:css",
"watch:js": "onchange 'assets/js/src/**/*.js' -- npm run build:js"
},
"dependencies": {
"chartist": "^0.11.4",
"codemirror": "^5.52.0",
"sortablejs": "^1.10.2"
},
"devDependencies": {
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-concat": "^2.6.1",
"gulp-rename": "^2.0.0",
"gulp-sass": "^4.0.2",
"gulp-uglify": "^3.0.2",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"node-sass": "^4.13.1",

12
admin/rollup.config.js Normal file
View File

@ -0,0 +1,12 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
export default {
input: 'assets/js/src/main.js',
output: {
file: 'assets/js/app.min.js',
format: 'iife',
name: 'Formwork'
},
plugins: [resolve(), commonjs()]
};