Comments (1)
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)
- Switch to plugin
- install via npm HOT 2
- Can't compile in directories with spaces in the name
- task completion callback called too many times HOT 1
- bug with custom css template HOT 1
- macOS Sierra HOT 5
- The 'enhanceSVG: true' flag doesn't seem to generate correct grunticon.loader.js HOT 2
- dest.on is not a function HOT 2
- The second argument passed into the Grunticon constructor must be a string
- Gulpicon won't generate any css files or preview.html HOT 1
- Custom function (with destination param) wrapping gulpicon() task works as called twice (from another task)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulpicon.