Giter Site home page Giter Site logo

A way detect task end about gulpicon HOT 1 CLOSED

akshayrawat avatar akshayrawat commented on July 29, 2024 2
A way detect task end

from gulpicon.

Comments (1)

froboy avatar froboy commented on July 29, 2024

I think I might have found a solution to this... I'm using a promise to check to see that preview.html exists, which is the last item that Grunticon writes to the destination directory, then using runSequence to make sure all of the things run together. This is kind of a mess, but it seems to work now:

// Task: Handle icons
// We have to do this in a few steps until
// https://github.com/filamentgroup/gulpicon/issues/1 is resolved
gulp.task('minifyIcons', function() {
  return gulp.src(config.icons.files)
      .pipe(svgmin())
      .pipe(gulp.dest(config.icons.min));
});

// Based on https://github.com/filamentgroup/gulpicon#usage
var iconFiles = glob.sync("source/assets/icons/svg/*.svg");
var iconConfig = require("./source/assets/icons/config.js");
iconConfig.dest = "public/assets/icons/";
gulp.task('makeIcons', gulpicon(iconFiles, iconConfig));

gulp.task('waitForIcons', function(callback) {
  var trigger = iconConfig.dest + 'preview.html';
  return pWaitFor(() => pathExists(trigger, '1000')).then(() => {
    console.log('Yay! The icons now exist.');
  });
});

gulp.task('reloadIcons', function() {
  return gulp.src('', {read: false})
    .pipe(browserSync.reload({stream:true}));
});

gulp.task('icons', function (callback) {
  runSequence('minifyIcons', 'makeIcons', 'waitForIcons', 'reloadIcons', callback);
});

This requires the includes as stated in https://www.npmjs.com/package/p-wait-for.

from gulpicon.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.