설명 없음

gulpfile.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const gulp = require('gulp');
  2. const rename = require('gulp-rename');
  3. const ts = require('gulp-typescript');
  4. const sass = require('gulp-sass');
  5. const merge = require('merge2');
  6. const tsProject = ts.createProject('./tsconfig.build.json');
  7. const run = require('gulp-run');
  8. gulp.task('build_styles', function () {
  9. return gulp.src('./src/styles/**/*.scss')
  10. .pipe(sass().on('error', sass.logError))
  11. .pipe(gulp.dest('./lib/styles/css'));
  12. });
  13. // library
  14. gulp.task('copy_styles', function () {
  15. return gulp.src('./src/styles/**/*.scss')
  16. .pipe(gulp.dest('./lib/styles/scss'));
  17. });
  18. gulp.task('build-lib', ['copy_styles', 'build_styles'], function () {
  19. const tsResult = gulp.src('src/**/*.{ts,tsx}')
  20. .pipe(tsProject({
  21. declaration: true
  22. }));
  23. return merge([
  24. tsResult.dts.pipe(gulp.dest('lib/definitions')),
  25. tsResult.js.pipe(gulp.dest('lib/js'))
  26. ]);
  27. });
  28. // demo
  29. // removes the output configuration from the webpack.config.js file, otherwise it doesn't work.
  30. gulp.task('copy-index', function () {
  31. return gulp.src('./demo/index.prod.html')
  32. .pipe(rename('index.html'))
  33. .pipe(gulp.dest('./docs'));
  34. });
  35. gulp.task('build-demo', ['copy-index'], function () {
  36. return run("npm run build:storybook").exec();
  37. });
  38. // all
  39. gulp.task('build', ['build-demo', 'build-lib']);