gulp

Gulp babel es2015 transform very slow

◇◆丶佛笑我妖孽 提交于 2019-12-21 07:04:50
问题 I am trying to run the babel-preset-es2015 on my JavaScript using gulp, but it takes forever even on one line of code. I originally tried with my script bundle that is about 700 loc, and then with a dummy script that is 1 line. The first case takes about 9s - with 1 line i takes 8.38s. This is my exact setup: package.json: { "devDependencies": { "gulp": "^3.9.0", "gulp-babel": "^6.1.1", "babel": "^6.3.26", "babel-preset-es2015": "^6.3.13" }, "babel": { "presets": [ "es2015" ] } } gulpfile.js:

Can I install just Gulp globally?

限于喜欢 提交于 2019-12-21 07:03:31
问题 I'm constantly working on new web development projects that don't ever, in practice, need their node_modules folder when deploying. It would suit me much more if I was just able to create a small gulpfile.js for each project, rather than 6000+ files contained in the node_modules folder for every project, that are only ever used by me on this machine. I only use Gulp to compile SASS and prefix and minify my CSS. I don't need to worry about any other type of deployment issues, but the

Visual Studio 2015 RC Gulp task runner not detecting tasks

风格不统一 提交于 2019-12-21 06:57:29
问题 I have a Gulpfile.js in Visual Studio 2015 RC with a single default task. For some reason it is not showing up in the Task Runner Explorer . I had added gulp to the devDependencies in my package.json file and saved it. 回答1: I was also facing the same issue. Just restarted Visual Studio after adding the tasks to gulpfile.js and my problem was solved. All tasks were listed. 回答2: In the release candidate, editing the devDependencies in package.json and then saving does not result in the packages

How do I prevent gulp-notify from breaking gulp-watch in Windows?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:23:27
问题 I am using the gulp-notify plugin. This is an example of how I'm implementing it in a gulpfile.js ( You can see I'm using gutil and livereload as well. I don't know if they play any factors, but let me know if they do.) gulp.task('js', function() { return gulp.src('./dev/scripts/*.coffee') .pipe(coffee({bare: true}).on('error', gutil.log)) .pipe( gulp.dest('./build/js')) .pipe(notify('Coffeescript compile successful')) .pipe(livereload(server)); }); This plugin works on OS X and Linux. On

gulp + browser-sync Cannot GET / error

岁酱吖の 提交于 2019-12-21 04:49:11
问题 I am learning the front-end build system currently gulp, i want to use brower-sync and the problem is it is not throwing an error in the commad line but instead when it brings up the browser it will not display my html file and it will say "Cannot GET /" error in the browser window. This is my gulpfile.js code var gulp = require('gulp'), uglify = require('gulp-uglify'), compass= require('gulp-compass'), plumber = require('gulp-plumber'), autoprefixer = require('gulp-autoprefixer'),

Error handling with gulp-notify and gulp-plumber

女生的网名这么多〃 提交于 2019-12-21 04:04:31
问题 I want to display a notification when: 1. An error occurs 2. When the script was successfully executed All notifications are actually working but the success notification is always displayed, even when there is an error. How can I make sure the success notification is only displayed when no errors have occurred? This is my current task: var gulp = require('gulp'); var sass = require('gulp-ruby-sass'); var rename = require('gulp-rename'); var notify = require('gulp-notify'); var plumber =

Passing variables between “pipes” in Gulp

我怕爱的太早我们不能终老 提交于 2019-12-21 03:54:14
问题 I'm trying to write a gulp tasks that takes some user input via the gulp-prompt plugin. But I'm having trouble passing that input along to other eg: gulp.task('userinput', function(){ var myVar = 'MONKEY'; gulp.src('./templates/_component.*') .pipe(prompt.prompt([ { type: 'input', name: 'userInput', message: 'Say something' } ], function(res){ myVar = res.userInput; })) .pipe(prompt.confirm('You said ' + myVar)); }); Assuming I enter hello at the prompt, I was expecting the confirmation to

Gulp: how to delete a folder?

别等时光非礼了梦想. 提交于 2019-12-21 03:52:35
问题 I use del package to delete folder: gulp.task('clean', function(){ return del('dist/**/*', {force:true}); }); But if there are many subdirectory in dist folder and I want to delete dist folder and all its files, is there any easy way to do it? Ps: I don't want to do in this way: dist/**/**/**/**/**/**/... when there are so many subdirectories. 回答1: your code should look like this: gulp.task('clean', function(){ return del('dist/**', {force:true}); }); according to the npm del docs "**"

Full Gulp Istanbul Coverage Report

不羁岁月 提交于 2019-12-21 03:33:36
问题 I am using gulp-istanbul to generate JavaScript unit test coverage reports through Gulp. Is there a way to configure Istanbul to generate a full coverage report of all the JS files in my gulp stream, and not just the files touched by a test case. I'm working on a project with a lot of JS, but no unit tests, and we are trying to increase the test coverage. I would like to have a coverage report that starts by show 0% coverage for most of our files, but over time will present an increasing

How to get task name inside task in gulp

风流意气都作罢 提交于 2019-12-21 03:33:07
问题 I'm using gulp-plumber + gulp-notify and want to put task name in gulp-notify as a title. following is the code i wrote, thanks in advance. gulp.task('SOMETASK', function() { return gulp.src(sourcePaths) .pipe(plumber({errorHandler: notify.onError({ message: "<%= error.message %>", title: "I WANT TO PUT TASK NAME HERE" })})) // omitted below }); 回答1: gulp.Gulp.prototype.__runTask = gulp.Gulp.prototype._runTask; gulp.Gulp.prototype._runTask = function(task) { this.currentTask = task; this._