tis-cli前端项目快速搭建命令行工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
950 B

  1. var gulp = require('gulp')
  2. var series = require('run-sequence').use(gulp)
  3. var task = require('./lib/task')
  4. var vars = require('./lib/gen-vars')
  5. var config = require('./lib/config')
  6. var build = function (opts) {
  7. return function () {
  8. return task.build(Object.assign(opts, {message: 'build theme'}))
  9. }
  10. }
  11. var fonts = function (opts) {
  12. return function () {
  13. return task.fonts(Object.assign(opts, {message: 'build theme font'}))
  14. }
  15. }
  16. exports.init = function (filePath) {
  17. filePath = {}.toString.call(filePath) === '[object String]' ? filePath : ''
  18. vars.init(filePath)
  19. }
  20. exports.watch = function (opts) {
  21. gulp.task('build', build(opts))
  22. exports.run(opts)
  23. gulp.watch(opts.config || config.config, ['build'])
  24. }
  25. exports.run = function (opts, cb) {
  26. gulp.task('build', build(opts))
  27. gulp.task('fonts', fonts(opts))
  28. if (typeof cb === 'function') {
  29. return series('build', 'fonts', cb);
  30. }
  31. return series('build', 'fonts');
  32. }