ant-design-blazor/components/gulpfile.js
Andrzej Bakun 29e3ce3583 refactor(interop): reorganization into classes and typescript tests (#1791)
* fix(module:interop): reorganization into classes

* comments clean-up

* Add typescript test project

* fix: sync with pull request #1765: support drag

* github test action fix attempt

* tests: jsinterop test mock fix

* codecov added to ts tests

* add generated split js to gitignore

* fix: coverage github action

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2021-07-29 22:45:47 +08:00

79 lines
2.2 KiB
JavaScript

var gulp = require('gulp'),
cleanCss = require('gulp-clean-css'),
less = require('gulp-less');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var tsify = require('tsify');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var buffer = require('vinyl-buffer');
var gts = require("gulp-typescript");
var tsProject = gts.createProject('tsconfig.json');
gulp.task('less-default', function () {
return gulp
.src('ant-design-blazor.less')
.pipe(less({ javascriptEnabled: true }))
.pipe(cleanCss({ compatibility: 'ie8' }))
.pipe(gulp.dest('wwwroot/css'));
});
gulp.task('less-aliyun', function () {
return gulp
.src('ant-design-blazor.aliyun.less')
.pipe(less({ javascriptEnabled: true }))
.pipe(cleanCss({ compatibility: 'ie8' }))
.pipe(gulp.dest('wwwroot/css'));
});
gulp.task('less-compact', function () {
return gulp
.src('ant-design-blazor.compact.less')
.pipe(less({ javascriptEnabled: true }))
.pipe(cleanCss({ compatibility: 'ie8' }))
.pipe(gulp.dest('wwwroot/css'));
});
gulp.task('less-dark', function () {
return gulp
.src('ant-design-blazor.dark.less')
.pipe(less({ javascriptEnabled: true }))
.pipe(cleanCss({ compatibility: 'ie8' }))
.pipe(gulp.dest('wwwroot/css'));
});
gulp.task('ts', function () {
return browserify({
basedir: '.',
debug: true,
entries: ['./main.ts'],
cache: {},
packageCache: {},
})
.plugin(tsify)
.transform('babelify', {
presets: ['es2015'],
extensions: ['.ts']
})
.bundle()
.pipe(source('ant-design-blazor.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('wwwroot/js'));
});
gulp.task("tsSplit", function () {
var tsResult = gulp.src('core/JsInterop/**/*.ts')
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('wwwroot/js/split'))
});
gulp.task('src', function () {
return gulp.src(['**/*.less', '!wwwroot/**']).pipe(gulp.dest('wwwroot/less'));
});
gulp.task('default', gulp.parallel('less-default', 'less-aliyun', 'less-compact', 'less-dark', 'ts', 'tsSplit', 'src'), function () { });