gulp

Gulp - start task with an argument

☆樱花仙子☆ 提交于 2019-12-03 21:58:52
问题 So I'm trying to create a gulp workflow and I'd like to implement options for some tasks, like gulp copy-images --changed . Now, I've created a watch task that obviously watches all image files and it should start the copy-images with the --changed flag. Ideally, I want to do something like this: gulp.task('copy-images', function(){ // some code }); gulp.task('watch', function(){ gulp.watch(config.images, ['copy-images --changed']); }); I'm also very aware that I could do: gulp.task('copy

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

三世轮回 提交于 2019-12-03 21:58:44
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 Windows, which doesn't have a notification feature, it returns an error and breaks the gulp-watch plugin.

Avoiding NPM global install using .bash_profile and “postinstall” script

帅比萌擦擦* 提交于 2019-12-03 21:44:31
NPM philosophy, for better or worse, is to have all necessary dependencies for a project to be locally installed, in ./node_modules , and for package.json to reflect all necessary deps. I have a library, that would typically benefit from both global installation and local installation, similar to Gulp, Mocha, etc. One of the most insiduous problems with the above, is that the global and local versions might differ, causing compatibility issues for a given project. It occurred to me that we could avoid this problem, by creating an alias in .bash_profile , something like this: # bash psuedocode

Compiling SASS and SUSY with GULP

泄露秘密 提交于 2019-12-03 21:44:14
I am trying to get gulp to compile my sass and use the susy grid/framework. I'm having troubles finding any information about this online. I have included: "gulp-ruby-sass": "^0.7.1", into my package.json and installed everything. My gulp sass gulp task likes like so: gulp.task('sass', ['images'], function () { return gulp.src('src/sass/*.{sass, scss}') .pipe(sass({ bundleExec: true, sourcemap: true, sourcemapPath: '../sass' })) .on('error', handleErrors) .pipe(gulp.dest('build')); }); So I can't for the life of me work out how to include susy so it complies using gulp , I haven't looked and

gulp command to take parameters

耗尽温柔 提交于 2019-12-03 21:44:05
my package.json has scripts like this { "scripts": { "pretest": "npm run tsc", "test": "gulp e2e", } } we use typescript and webdriverIO for automation. I want to use gulp so that i can pass parameters to my test framework. Example: npm test --suite HomePageTests then the specs related to Home page must run. I have the gulp file like this // gulpfile.js const gulp = require('gulp'); const Launcher = require('webdriverio/build/lib/launcher'); const wdio = new Launcher(path.join(__dirname, 'src/config/conf.ts')); // fetch command line arguments const arg = (argList => { let arg = {}, a, opt,

Gulp using gulp-jade with gulp-data

落花浮王杯 提交于 2019-12-03 21:24:49
I'm trying to use gulp-data with gulp-jade in my workflow but I'm getting an error related to the gulp-data plugin. Here is my gulpfile.js var gulp = require('gulp'), plumber = require('gulp-plumber'), browserSync = require('browser-sync'), jade = require('gulp-jade'), data = require('gulp-data'), path = require('path'), sass = require('gulp-ruby-sass'), prefix = require('gulp-autoprefixer'), concat = require('gulp-concat'), uglify = require('gulp-uglify'), process = require('child_process'); gulp.task('default', ['browser-sync', 'watch']); // Watch task gulp.task('watch', function() { gulp

Gulp: only compile changed files AND compile parents when imported SCSS file is edited

时间秒杀一切 提交于 2019-12-03 20:45:22
At work we used to use Ruby to compile SCSS. I had the Ruby compiler set up as a file watcher in PhpStorm, and when I edited a partial imported by another file, the CSS file corresponding to the ancestor file was updated without any fuss. I want to get Gulp and Libsass to work the same way. Most solutions I've seen just compile all the SCSS files in a project when a single one changes, but our projects have way too much SCSS for that to be an acceptable solution. gulp-cached seemed like a great solution to this problem. But when I use gulp-cached the CSS output file doesn't change when I edit

events.js:160 throw er; // Unhandled 'error' event

别说谁变了你拦得住时间么 提交于 2019-12-03 18:30:15
问题 The project I worked on was built with gulp. Recently I updated the node version to v6.3.1. Then something came wrong. A task named 'html' throws an error. Here is the part of error code of it. bogon:toClient work$ gulp html (node:2519) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. [10:26:10] Using gulpfile ~/Project/TIME_Cancer_Treatment_Centers_of_America(CTCA)/toClient/gulpfile.js [10:26:10]

How to run a gulp task from another task?

半城伤御伤魂 提交于 2019-12-03 15:31:07
问题 I am aware of the ability to declare dependencies that will run before the task, e.g. gulp.task('a', () => {}); gulp.task('b', () => {}); gulp.task('c', ['a', 'c'], () => {}); Tasks 'a' and 'b' will be run every time after task 'c' is called and before task 'c' is executed. However, how do I programmatically call an arbitrary task from within a gulp.task ? 回答1: I did it using gulp.start(); like this: gulp.task('test1', function(){ gulp.start('test2'); }) gulp.task('test2', function(){ // do

Glob /* doesn't match files starting with dot

非 Y 不嫁゛ 提交于 2019-12-03 15:16:38
问题 I'm using gulp to copy all files from one dir to another using code like this: gulp.src([ 'app/**/*' ]).pipe(gulp.dest('dist')); Glob docs say * match all files, but in fact files which have names starting with dot, like .gitignore , are not copied. How can it be worked around? 回答1: If you add the option dot: true , it should work. Eg: gulp.task('something', function () { return gulp.src([ 'app/**/*' ], { dot: true }).pipe(gulp.dest('dist')); }); Reference 来源: https://stackoverflow.com