gulp

Deleting files in a gulp task

非 Y 不嫁゛ 提交于 2019-11-30 22:02:21
I have a gulp task in which I want to take some source files and copy them to build/premium and build/free and then remove some extra files from build/free . My attempt at that was doing this: gulp.task("build", ["clean"], function () { gulp.src(["src/*", "!src/composer.*", "LICENSE"]) .pipe(gulp.dest("build/premium")) .pipe(del(["build/free/plugins/*", "!build/free/plugins/index.php"])) .pipe(gulp.dest("build/free")); }); Which results in an error: TypeError: dest.on is not a function at DestroyableTransform.Stream.pipe (stream.js:45:8) at Gulp.<anonymous> (/Users/gezim/projects/myproj

How to tell Gulp to skip or ignore some files in gulp.src([…])?

前提是你 提交于 2019-11-30 21:27:34
问题 How can I tell Gulp to skip or ignore some files in gulp.src([...]) ? For instance, I don't want to compress and concat this file in my css/ folder - 'css/ignnore.css' ? var autoprefix = require('gulp-autoprefixer'), concat = require('gulp-concat'), minifyCss = require('gulp-minify-css'); gulp.task('styles', function() { gulp.src([ 'css/ignnore.css', // ignore this file 'css/*.css' ]) .pipe(concat('styles.css')) .pipe(autoprefix('last 2 versions')) .pipe(minifyCss()) .pipe(gulp.dest('local

Gulp Task Error: 'Checksum error in glyf'

岁酱吖の 提交于 2019-11-30 21:00:13
问题 I am attempting to run a Gulp task and I get an error that I have no idea how to fix or even debug. The Gulp file and tasks have been created by NetSuite and haven't been editted by myself (they should work out of the box). Any idea what node package could be causing the following error and how I can fix the error? Maybe I need to use a different version of SASS or Font-Awesome? C:\Users\MyUser\SuiteCommerce Advanced Mont Blanc>gulp local [08:48:45] Warning: gulp version mismatch: [08:48:45]

Gulp Autoprefixer Not Working

折月煮酒 提交于 2019-11-30 20:53:32
I'm unable to get Autoprefixer to work with Gulp. I'm using opacity in my CSS, gradients, and transforms and there aren't any vendor prefixes showing up. Otherwise, everything else is working. Here's my gulp file: var gulp = require('gulp'); var lr = require('tiny-lr'); var jshint = require('gulp-jshint'); var sass = require('gulp-sass'); var autoprefixer = require('gulp-autoprefixer'); var minifycss = require('gulp-minify-css'); var concat = require('gulp-concat'); var rename = require('gulp-rename'); var livereload = require('gulp-livereload'); var server = lr(); var plumber = require('gulp

Gulp - CALL_AND_RETRY_LAST Allocation failed - process out of memory

江枫思渺然 提交于 2019-11-30 20:17:01
When calling one of my gulp task, I get " FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory ". I found in this question that I can pass a parameter to node to increase the default memory limit : node --max-old-space-size=2000 server.js . But how can I tell gulp to pass a parameter to node.exe ? Here is the list of flags I can pass to gulp, I was hoping to find one that gulp passes to node when it launches it for a task. The task causing the issue : var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); gulp.task('imagemin', function() { var OUTPUT_FOLDER

Why don't newly added files trigger my gulp-watch task?

霸气de小男生 提交于 2019-11-30 19:08:54
I have a gulp task which uses gulp-imagemin to compress images. When I add new files to this directory I'd like for this task to compress them as well. I read that gulp.watch doesn't trigger on new files and that I should try gulp-watch so I used it like so; gulp.task('images', function() { watch({glob: './source/images/*'}, function (files) { return files .pipe(plumber()) .pipe(imagemin({ progressive: true, interlaced: true })) .pipe(gulp.dest('./www')); }); }); This works the same as gulp.watch on the first run, but when I add a new image to the directory nothing happens. If I overwrite an

How to inject variable value into JS file from GULP

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 19:06:59
Hopefully this is a quick question. What I'm trying to do is to add a timestamp into a Javascript object in a JS file while the file is being built with GULP. Basically, in "file.js", I have an object where I would like to have object.timeStamp that equals the time of the GULP build. I am currently adding a timestamp to the top of the file using gulp-header, but I have been asked to add the timestamp to a property in the object. My thought was to inject the value from GULP, but all of the injection plugins I have found so far are for injecting contents of one file into the target file. Any

Open Karma debug.html page on startup

萝らか妹 提交于 2019-11-30 18:34:48
The short version: How do I start up Karma and have it open the debug.html file automatically in the same browser as the Karma start page? The long version: I'm not a huge fan of using the console reporters for Karma, so I have been using karma-jasmine-html-reporter-livereload which outputs to Karma's localhost:9876/debug.html file. The problem is, every time I start a debugging session, I have to click the 'debug' button in the web page that karma opens. I would like to find a way to have karma open the debug.html page automatically through a gulp task. I run the tests in multiple browsers,

How can I promise-ify a one-off usage of gulp in my application?

这一生的挚爱 提交于 2019-11-30 18:19:01
As part of a small program I'm writing, I would like to use gulp to convert a large set of a files to markdown. This is not part of a build step separate from the program. It's a part of the program. So I'm not using a gulpfile to handle this. The problem is, since it's async, I want to use a promise which will alert me when the gulp task is finished. Something like this would be ideal: io.convertSrc = function() { var def = q.defer(); gulp.src(src + '/*.md') .pipe(marked({})) .pipe(gulp.dest(dist), function() { def.resolve('We are done!'); }); return def.promise; } But pipe doesn't take a

GULP 快速上手教程

孤者浪人 提交于 2019-11-30 17:44:13
GULP gulp是前端开发过程中对代码进行构建的工具她不仅能对网站资源进行优化,而且在开发过程中很多重复的任务能够使用正确的工具自动完成;使用她,我们不仅可以很愉快的编写代码,而且大大提高我们的工作效率。 gulp是基于Nodejs的自动任务运行器,她能自动化地完成 javascript/coffee/sass/less/html/image/css 等文件的的测试、检查、合并、压缩、格式化、浏览器自动刷新、部署文件生成,并监听文件在改动后重复指定的这些步骤。在实现上,她借鉴了Unix操作系统的管道(pipe)思想,前一级的输出,直接变成后一级的输入,使得在操作上非常简单。 gulp 和 grunt 非常类似,但相比于 grunt 的频繁 IO 操作,gulp 的流操作,能更快地更便捷地完成构建工作。 gulp 是基于note.js的首先确保自己已经安装了node.js 选装cnpm npm插件都是在外国的服务器上,因为网络波动影响比较大。所以我们可以去淘宝对我们做了很大的贡献 网址 http://npm.taobao.org #1.安装淘宝的镜像 他的命令是:npm install -g cnpm --registry=https://registry.npm.taobao.org #2.生成项目描述文件 packge.json cnmp init (可以代替 npm init