gulp

Gulp Watch only run once

假装没事ソ 提交于 2019-12-03 04:31:47
I'm using this Gulp Watch sample: https://github.com/floatdrop/gulp-watch/blob/master/docs/readme.md#starting-tasks-on-events . var gulp = require('gulp'); var watch = require('gulp-watch'); var batch = require('gulp-batch'); gulp.task('build', function () { console.log('Working!'); }); gulp.task('watch', function () { watch('**/*.js', batch(function () { gulp.start('build'); })); }); When I run it on my Windows 8 machine, it only runs the first time I change a file: C:\test>gulp watch [08:40:21] Using gulpfile C:\test\gulpfile.js [08:40:21] Starting 'watch'... [08:40:21] Finished 'watch'

How to run gulp tasks from a node script

两盒软妹~` 提交于 2019-12-03 04:21:50
I have a node script and I want to run a gulp task I have in the same script, how can I call it? #!/usr/bin/env node var gulp = require('gulp'); gulp.task('default', function (arg) { }); // How do I call the task 'default' Eventually I found the way: gulp.start('default'); Use an array in start method, in the case someone is looking for a way of running multiple tasks from search engines. gulp.start( [ 'task1', 'task2' ] ); 来源: https://stackoverflow.com/questions/28481020/how-to-run-gulp-tasks-from-a-node-script

Does Meteor need either Gulp or Grunt?

送分小仙女□ 提交于 2019-12-03 04:20:41
问题 So I've been reading about Gulp and Grunt, and how they can minify code, compress files, combine files into one, livereload etc. However, Meteor does all that already, with Isobuild. The reason I'm asking is someone suggested using Gulp with Meteor, and I don't see a need for it. What are some possible reasons why I should run Gulp alongside Meteor? Or it is simply redundant? If it is not redundant, what features does Gulp has that is not in Isobuild? And will the Meteor team plan to

How to run a gulp task from another task?

痴心易碎 提交于 2019-12-03 04:10:13
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 ? I did it using gulp.start(); like this: gulp.task('test1', function(){ gulp.start('test2'); }) gulp.task('test2', function(){ // do something }) I was using gulp 3.9.1 if it matters. Looks like gulp.start() may be removed or deprecated; but

GulpUglifyError:Unable to minify JavaScript

血红的双手。 提交于 2019-12-03 04:04:42
问题 I am trying to minify my script files for which i am using gulp task runner And I am trying gulp-uglify plugin Code: gulp.task('concat', function() { return gulp.src('app/**/*.js') // .pipe(concat('script.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')) }); but i am getting error as when i try to run gulp task as gulp concat Any help would be appreciated 回答1: The main error is generated when you're using ES6 format. Use the gulp-uglify-es module instead of 'gulp-uglify' to overcome this

Local gulp not found (Try running: npm install gulp)

白昼怎懂夜的黑 提交于 2019-12-03 04:00:38
问题 I created a module ( webapp-module-storage ) which has the following definitions: package.json { "dependencies": { ... }, "devDependencies": { "gulp": "^3.9.1", ... }, "name": "webapp-module-storage", "scripts": { "postinstall": "gulp build", "test": "gulp test" } } I thought I can use my module inside another module when installing it with: npm install github:myorg/webapp-module-storage#master However, when I install my module, I am getting this error: Local gulp not found Try running: npm

How to inject content of CSS file into HTML in Gulp? [closed]

淺唱寂寞╮ 提交于 2019-12-03 03:36:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I need to insert the content of a stylesheet into the <head> of an HTML page. How can I do it in Gulp? Before (what I have): <head> <link href="style.css" rel="stylesheet" type="text/css" /> </head> After (what I want): <head> <style> p { color: pink; } </style> </head> Note that I do not need to inline CSS into

Why do I have to use vinyl-source-stream with gulp?

我们两清 提交于 2019-12-03 03:27:25
问题 I am trying to use gulp and browserify to transform my .jsx files into .js files. var gulp = require('gulp'); var browserify = require('browserify'); var reactify = require('reactify'); gulp.task('js', function () { browserify('public/javascripts/src/app.jsx') .transform(reactify) .bundle() .pipe(gulp.dest('public/javascripts/dist')) }); ``` The above threw Arguments to path.resolve must be strings . I managed to get around it by using vinyl-source-stream var source = require('vinyl-source

Using variables in Gulp for the destination file name?

感情迁移 提交于 2019-12-03 03:14:46
I am new to gulp and I am wondering if what I want to achieve is practical or possible. My projects structure: root | components | | | component_1 | | styles.scss | | actions.js | | template.html | | ... | component_2 | | styles.scss | | template.html | | ... | public | assets | css (dest) | component_1.css | component_2.css | ... js (dest) Now what I want is that Gulp stores the compiled css files in the according css folder in public/assets but uses the name of folder where it found the scss file. Is that possible? Do I need to pipe that to a plugin? Thanks! PS i do realize I could achieve

Chain Gulp glob to browserify transform

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a project with a few relatively disjoint pages, each including their own entry point script. These scripts require a number of others using commonjs syntax, and need to be transformed by 6to5 and bundled by browserify. I would like to set up a gulp task that captures all the files matching a pattern and passes them on to the bundler, but I'm not sure how to pass files from gulp.src to browserify(filename) . My gulpfile looks like: var gulp = require("gulp"); var browserify = require("browserify"); var to5browserify = require("6to5