JSFiddle - React, Tailwind, and code Playground
JavaScript
//* this file follow typescript handbook recommendations */
/// <reference path="./typings/index.d.ts" />
/* jslint esversion: 6 */
var gulp = require('gulp');
var less = require('gulp-less');
var watch = require('gulp-watch');
var concat = require('gulp-concat');
var browserify = require("browserify");
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var watchify = require("watchify");
var sourcemaps = require('gulp-sourcemaps');
var tsify = require("tsify");
var gutil = require("gulp-util");
var browserSync = require('browser-sync').create();
var uglify = require('gulp-uglify');
var addsrc = require('gulp-add-src');
var merge = require('merge-stream');
var paths = {
staticContentDir: './src/content',
entryPoint: "src/index.ts",
tests: "src/tests.ts",
styles: ['./src/styles/*.less', './src/styles/bootstrap/bootstrap.less'],
distDir: "./dist/",
scripts: [
"./src/scripts/*.js",
]
};
var config = {
externalModules: ['react', 'react-dom', 'react-router', 'react-bootstrap']
};
/* Compiles, Waches for changes and starts development server */
gulp.task('default', ['watch', 'compile'], function () {
devServer();
});
/* Compiles everything */
gulp.task('compile', ['compile-less', 'compile-typescript', 'bundle-externalscripts', 'copy-static']);
/* Watch everything */
gulp.task('watch', ['watch-less', 'watch-typescript', 'watch-static']);
/* Opens the application in the browsers */
gulp.task('dev-server', devServer);
function devServer() {
browserSync.init({
server: paths.distDir,
});
}
gulp.task('watch-static', function () {
gulp.src(paths.staticContentDir + '/**/*', { base: paths.staticContentDir })
.pipe(watch(paths.staticContentDir, { base: paths.staticContentDir })
.on('change', (event, path) => { gutil.log(gutil.colors.cyan("changed"), gutil.colors.magenta(event)); })
)
.pipe(gulp.dest(paths.distDir))
.pipe(browserSync.stream());
});
/* Task to copy all static...