gulp

GULP: gulp is not defined

喜欢而已 提交于 2019-11-30 17:23:22
问题 As shown in the screen shot below I am not able to run gulp to concat the JavaScript files. Its saying that gulp is not defined . I have tried the following commands: npm install -g gulp npm install gulp npm install gulp --save-dev I have also set the environment variables as following: C:\Users\<user>\AppData\Roaming\npm;C:\Python27;C:\Users\<user>\AppData\Roaming\npm\node_modules;C:\Users\<user>\AppData\Roaming\npm\node_modules\gulp; var concat = require('gulp-concat'); var rename = require

Gulp - copy and rename a file

余生颓废 提交于 2019-11-30 16:46:33
I'm extremely new to Gulp. I'm basically trying to watch for a modified JavaScript file, and then make a new copy of it with a new name. (eventually there'll be some processing on it, but Rome wasn't built in a day). My (naive) attempt is this: gulp.task('default', function() { return gulp.watch('../**/**.js', function(obj){ gulp.src(obj.path) .pipe(gulp.dest('foobar.js')); }); }); This takes the modified file and successfully copies it into a folder now called foobar.js. Is there anything simple I can replace gulp.dest('foobar.js') with that will simply copy and rename the src file in place?

What does Gulp “done” method do?

て烟熏妆下的殇ゞ 提交于 2019-11-30 14:41:45
问题 Just a simple question to clarify what does parameter "done" in a gulp task do? I understand, this is the callback in task function as shown below. gulp.task('clean', function(done) { // so some stuff creategulptask(cleantask(), done); }); But what is the reason to pass it? 回答1: The gulp documentation specifies something similar to the following: var gulp = require('gulp'); // Takes in a callback so the engine knows when it'll be done // This callback is passed in by Gulp - they are not

Gulp clean / del behaviour has changed

限于喜欢 提交于 2019-11-30 14:16:27
Part of my gulpfile.js const del = require('del'); const chrome_dir = 'build/chrome'; const ff_dir = 'build/firefox'; gulp.task('clean', function (cb) { del([chrome_dir, ff_dir], cb); }); gulp.task('default', ['clean'], function () { gulp.start('build packages', 'JS Backend', 'i18n', 'ExtRes', 'styles', 'JS Content', 'templates'); }); worked well. Then I installed a new system and there maybe got new versions of gulp and del and whatever. Now gulp stops after cleaning. I can call all tasks manually, that's working fine. Could only be a change in the behaviour of del... How can I fix this? One

npm WARN optional dep failed, continuing fsevents@0.3.6

不羁岁月 提交于 2019-11-30 13:47:22
问题 I am install browserSync npm install browser-sync but have a problem npm WARN optional dep failed, continuing fsevents@0.3.6 What is this error and how it can be solved ? gulp does not start P.S: It worked before . Already 2 project so created. clear cache - not help 回答1: Hi fsevents is an API available only on OSX. So if you're using another OS like Windows as do I. Normally software that wants to use fsevents will provide an alternative or make it optional as your message reads. To my

Bests practice for Browserify in large web projects - Gulp

拜拜、爱过 提交于 2019-11-30 12:15:36
问题 Here is the thing, I come from a world where you have several js files included to a web page. Some are always included in the page (your libs, menu etc...) and others are depending on the current page (js for login page, js for subscription etc...). Basically let's say that I have 1 different js file per page plus the libs. Now I want to start a new project with browserify and I am in front of a big problem : In all the examples I have seen, there is always a single entry point (like app.js)

Gulp less not handling includes properly, included variables not defined

不想你离开。 提交于 2019-11-30 11:55:32
问题 I am using less and Grunt, and am moving to gulp. My less works. When I run: lessc public/less/myapp.less I get working output with no errors. All my less, including includes, is in public/less , BTW. Here is my gulpfile: var gulp = require('gulp'); var prefixer = require('gulp-autoprefixer'); var less = require('gulp-less'); gulp.task('compileLess', function () { gulp .src('./public/less/*') .pipe(less({ paths: ['./public/less'], // Search paths for imports filename: 'myapp.less' })) .pipe

How to clean a project correctly with gulp?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 11:44:31
问题 On the gulp page there is the following example: gulp.task('clean', function(cb) { // You can use multiple globbing patterns as you would with `gulp.src` del(['build'], cb); }); gulp.task('scripts', ['clean'], function() { // Minify and copy all JavaScript (except vendor scripts) return gulp.src(paths.scripts) .pipe(coffee()) .pipe(uglify()) .pipe(concat('all.min.js')) .pipe(gulp.dest('build/js')); }); // Copy all static images gulp.task('images', ['clean'], function() { return gulp.src(paths

What does Gulp “done” method do?

你。 提交于 2019-11-30 11:27:37
Just a simple question to clarify what does parameter "done" in a gulp task do? I understand, this is the callback in task function as shown below. gulp.task('clean', function(done) { // so some stuff creategulptask(cleantask(), done); }); But what is the reason to pass it? Seer The gulp documentation specifies something similar to the following: var gulp = require('gulp'); // Takes in a callback so the engine knows when it'll be done // This callback is passed in by Gulp - they are not arguments / parameters // for your task. gulp.task('one', function(cb) { // Do stuff -- async or otherwise /

Node's del command - callback not firing

青春壹個敷衍的年華 提交于 2019-11-30 11:24:25
I'm working through a pluralsight course on gulp. John Papa is demonstrating how to inject a function that deletes existing css files, into the routine that compiles the new ones. The callback on the del function is not firing. The del function is running, file are deleted, I see no error messages. If I call the callback manually it executes, so looks like the function is in tact. So I am wondering what would cause del not to want to execute the callback. delete routine: function clean(path, done) { log('cleaning ' + path); del(path, done); // problem call } The 'done' function is not firing,