-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ebd0be
commit 675de69
Showing
5 changed files
with
226 additions
and
323 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,59 @@ | ||
const gulp = require('gulp'); | ||
const rename = require('gulp-rename'); | ||
const ts = require('gulp-typescript'); | ||
const sass = require('gulp-sass'); | ||
const merge = require('merge2'); | ||
const tsProject = ts.createProject('./tsconfig.build.json'); | ||
const webpackStream = require('webpack-stream'); | ||
const gulp = require("gulp"); | ||
const rename = require("gulp-rename"); | ||
const ts = require("gulp-typescript"); | ||
const sass = require("gulp-sass"); | ||
const merge = require("merge2"); | ||
const tsProject = ts.createProject("./tsconfig.build.json"); | ||
const webpackStream = require("webpack-stream"); | ||
|
||
gulp.task('build_styles', function () { | ||
return gulp.src('./src/styles/**/*.scss') | ||
.pipe(sass().on('error', sass.logError)) | ||
.pipe(gulp.dest('./lib/styles/css')); | ||
}); | ||
function buildStyles() { | ||
return gulp | ||
.src("./src/styles/**/*.scss") | ||
.pipe(sass().on("error", sass.logError)) | ||
.pipe(gulp.dest("./lib/styles/css")); | ||
} | ||
|
||
// library | ||
gulp.task('copy_styles', function () { | ||
return gulp.src('./src/styles/**/*.scss') | ||
.pipe(gulp.dest('./lib/styles/scss')); | ||
}); | ||
function copyStyles() { | ||
return gulp | ||
.src("./src/styles/**/*.scss") | ||
.pipe(gulp.dest("./lib/styles/scss")); | ||
} | ||
|
||
gulp.task('build-lib', ['copy_styles', 'build_styles'], function () { | ||
const tsResult = tsProject.src() | ||
.pipe(tsProject({ | ||
declaration: true | ||
})); | ||
return merge([ | ||
tsResult.dts.pipe(gulp.dest('lib/definitions')), | ||
tsResult.js.pipe(gulp.dest('lib/js')) | ||
]); | ||
}); | ||
// depends on copyStyles and buildStyles | ||
function buildLib() { | ||
const tsResult = tsProject.src().pipe( | ||
tsProject({ | ||
declaration: true | ||
}) | ||
); | ||
return merge([ | ||
tsResult.dts.pipe(gulp.dest("lib/definitions")), | ||
tsResult.js.pipe(gulp.dest("lib/js")) | ||
]); | ||
} | ||
|
||
// demo | ||
// removes the output configuration from the webpack.config.js file, otherwise it doesn't work. | ||
|
||
gulp.task('copy-index', function () { | ||
return gulp.src('./demo/index.prod.html') | ||
.pipe(rename('index.html')) | ||
.pipe(gulp.dest('./docs')); | ||
}); | ||
function copyIndex() { | ||
return gulp | ||
.src("./demo/index.prod.html") | ||
.pipe(rename("index.html")) | ||
.pipe(gulp.dest("./docs")); | ||
} | ||
|
||
gulp.task('build-demo', ['copy-index'], function () { | ||
return gulp.src('demo/client.ts') | ||
.pipe(webpackStream(require('./webpack.config.demo.prod.js'), require("webpack"))) | ||
.pipe(gulp.dest('docs/')) | ||
}); | ||
// depends on copyIndex | ||
function buildDemo() { | ||
return gulp | ||
.src("demo/client.tsx") | ||
.pipe( | ||
webpackStream( | ||
require("./webpack.config.demo.prod.js"), | ||
require("webpack") | ||
) | ||
) | ||
.pipe(gulp.dest("docs/")); | ||
} | ||
|
||
// all | ||
gulp.task('build', ['build-demo', 'build-lib']); | ||
exports.build = gulp.series(buildStyles, copyStyles, copyIndex, buildLib, buildDemo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.