Is there any way to check what gulp version you have installed?
Simply use: gulp -v From the docs: https://github.com/gulpjs/gulp/blob/master/docs/CLI.md
Simply use: gulp -v From the docs: https://github.com/gulpjs/gulp/blob/master/docs/CLI.md
The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally. For example if you installed gulp 3.9.1 globally and your project testGulp4 has gulp 4.0 installed locally, what would happen if you run gulp -v into testGulp4? Without gulp-cli globally installed : CLI version 3.9.1 In … Read more
If you do not return a stream, then the asynchronous result of each task will not be awaited by its caller, nor any dependent tasks. For example, when not returning streams: $ gulp scripts [21:25:05] Using gulpfile ~/my-project/gulpfile.js [21:25:05] Starting ‘tsc’… [21:25:05] Finished ‘tsc’ after 13 ms [21:25:05] Starting ‘scripts’… [21:25:05] Finished ‘scripts’ after 10 … Read more
You could easily use gulp-replace, like so: var gulp = require(‘gulp’), replace = require(‘gulp-replace’), fs = require(‘fs’); // in your task return gulp.src(…) .pipe(replace(/<link href=”https://stackoverflow.com/questions/23820703/style.css”[^>]*>/, function(s) { var style = fs.readFileSync(“https://stackoverflow.com/questions/23820703/style.css”, ‘utf8’); return ‘<style>\n’ + style + ‘\n</style>’; })) .pipe(gulp.dest(…)); You can also easily modify the replacement RegEx to work with different files, too. return … Read more
Use the gulp-if plugin: var gulpif = require(‘gulp-if’); g.task(‘sass’, function() { return g.src(sources.sass) .pipe(changed(output.css)) .pipe(sass({style:’compressed’, sourcemap:true})) // Conditional output .pipe(gulpif(condition1, g.dest(output.css))) .pipe(gulpif(condition2, g.dest(output.css2))) .pipe(notify(‘scss converted to css and compressed <%= file.relative %>’)); });
Options are set to compile on save When you save a file it is automatically compiling that single file and files imported on that file. Turn off auto compile option from your IDE, so compiler will consider tsconfig.json file. When input files are specified on the command line, tsconfig.json files are ignored. The presence of … Read more
This answer has been appended to reflect recent changes to Gulp. I’ve retained the original response, for relevance to the OPs question. If you are using Gulp 2.x, skip to the second section Original response, Gulp 1.x You may change this default behavior by passing errLogToConsole: true as an option to the sass() method. Your … Read more
You need to ignore ‘error’ and always emit ‘end’ to make ‘gulp.watch’ work. function handleError(err) { console.log(err.toString()); this.emit(‘end’); } gulp.task(“test”, function() { return gulp.src(paths.tests) .pipe(mocha({ reporter: “spec” }) .on(“error”, handleError)); }); This makes ‘gulp test’ to always return ‘0’ which is problematic for Continuous Integration, but I think we have no choice at this time.
I ran into the same issue as you. To fix it, I added the following to my package.json in the devDependencies section “natives”: “^1.1.6”
(In December 2017, the gulp-util module, which provided logging, was deprecated. The Gulp team recommended that developers replace this functionality with the fancy-log module. This answer has been updated to reflect that.) fancy-log provides logging and was originally built by the Gulp team. var log = require(‘fancy-log’); log(‘Hello world!’); To add logging, Gulp’s API documentation … Read more