gulpfile.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. layer构建
  3. */
  4. const {src, dest, series} = require('gulp');
  5. var pkg = require('./package.json');
  6. var uglify = require('gulp-uglify');
  7. var minify = require('gulp-clean-css');
  8. var rename = require('gulp-rename');
  9. var header = require('gulp-header');
  10. var del = require('del');
  11. var task = {
  12. layer: function () {
  13. src('./src/**/*.css')
  14. .pipe(minify({
  15. compatibility: 'ie7'
  16. }))
  17. .pipe(dest('./dist'));
  18. return src('./src/layer.js').pipe(uglify())
  19. .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg}))
  20. .pipe(dest('./dist'));
  21. }
  22. , mobile: function () {
  23. return src('./src/mobile/layer.js').pipe(uglify())
  24. .pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %>mobile By <%= pkg.author %> */\n ;', {pkg: pkg}))
  25. .pipe(dest('./dist/mobile'));
  26. }
  27. };
  28. exports.layer = task.layer;
  29. exports.mobile = task.mobile;
  30. exports.default = series(task.layer, task.mobile);