Tag: gulp

没有findgulp命令(Mac OS)

我一直在尝试设置一个angular度js项目,哟,咕噜声和发电机吞咽angular。 虽然我安装了所有的软件包,但没有findgulp命令,但是如果我进入node_modules的话,它就可以工作。 这段代码将解释我的问题: $ npm -v # 2.5.1 $ npm install -g yo $ npm install -g generator-gulp-angular $ mkdir client && cd $_ $ yo gulp-angular ng_demo $ gulp serve # command not found $ node_modules/gulp/bin/gulp.js serve # works 我正在使用zsh。 什么可能出错?

以编程方式控制Jetbrains内置服务器

我使用WebStorm,它带有非常棒的LiveEditfunction,它比LiveReload好得多,但是它不会自动将更改logging到我正在使用的所有不同types的文件中。 它忽略了手写笔和翡翠的变化,我需要手动触发重新加载页面。 我猜是因为LiveEdit不会重新加载整个页面,而只是重新加载相关的部分,Webstorm当然不可能知道在处理Jade或者Ejs模板的时候页面上需要重绘的东西 就此而言,LiveReload感觉是更好的解决scheme。 但我想知道是否有可能通过发送信号到“JetBrains IDE支持扩展”来触发重新加载页面? 所以理想的grunt-task或gulp-task (我正在使用gulp)会监视文件的变化并发送信号(可能是WebStorms内置的服务器),扩展会重新载入页面。 那可能吗? 你可以控制Jetbrains内置服务器与节点?

gulp connect-livereload不能在Node.js中使用简单的应用程序

我试图让connect-livereload工作,以便dynamic地插入livereload所需的脚本。 ( NPM连接重新加载 ) 我的gulpfile相关的片段: var express_app = require('./app.js')(), express = require('express'), gulp = require('gulp'), lr = require('tiny-lr')(); gulp.task('default', function() { initServer(); initLiveReload(); } // This is supposed to insert the middleware function initServer() { express_app.use(require('connect-livereload')()); express_app.use(express.static(__dirname)); express_app.listen(3000); } function initLiveReload() { lr.listen(35729); }; 我的app.js相关代码片段: var express = require('express'), app = express(); module.exports = function() […]

gulp.watch错误:结束后写入

我得到不同的结果为不同的gulp.watch指令当我执行我的watch任务并且改变一个.html文件,一切工作正确(下面定义的任务) 但是当我改变任何其他文件(.coffee,.less等),我得到这个错误: stream.js:94 throw er; // Unhandled stream error in pipe. ^ Error: write after end at writeAfterEnd (/Users/oclement/Documents/phoenix/MedifastCerBrokenDown/MedifastWeb/AppSource/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:145:12) at Transform.Writable.write (/Users/oclement/Documents/phoenix/MedifastCerBrokenDown/MedifastWeb/AppSource/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:193:5) at Stream.ondata (stream.js:51:26) at Stream.emit (events.js:95:17)gulp.watch` 观看任务 gulp.task('watch', function() { isWatching = true; run('build', 'index', function() { g.util.log(g.util.colors.green('Starting to Watch')); gulp.watch('./app/**/*.html', ['templates']); gulp.watch('./app/**/*.coffee', ['phnxjs']); … }); }); 模板任务 gulp.task('templates', function(done) { g.util.log(g.util.colors.green('—TEMPLATES—')); sourceStreams.templates() […]

Gulp保存stream保存目录结构

我有一个插件,使用此function在stream中生成新的文件 var pass = through2.obj(function (file, enc, callback) { if (!gulpmatch(file, __json_condition)) { this.push(file); }else { compiled_files = bootsie_compiler.build_from_buffer(file.contents, {stream:true}); for (var i =0; i<compiled_files.length; i++){ this.push(new gutil.File( { base: compiled_files[i].base, path: compiled_files[i].path, contents: new Buffer(compiled_files[i].contents) }) ); } } callback(); }); 一切正常,gulp-filelogs在stream中输出3个文件 [21:51:34] [1] [Path:/home/michael/Projects/OpenSource/Portfolio/www/build/index.html] [Base:/home/michael/Projects/OpenSource/Portfolio/www/build] [CWD:/home/michael/Projects/OpenSource/Portfolio/www] [21:51:34] [2] [Path:/home/michael/Projects/OpenSource/Portfolio/www/build/archive/test/index.html] [Base:/home/michael/Projects/OpenSource/Portfolio/www/build/archive/test] [CWD:/home/michael/Projects/OpenSource/Portfolio/www] [21:51:34] [3] […]

使用Gulp.js模板编译器呈现HTML

使用任何一个Gulp模板编译器来呈现HTML文件最简单的方法是什么? gulp.task('html', function () { gulp.src('templates/**/*') .pipe(handlebars()) .pipe(whatCanGoHereToRenderHTML()) .pipe(gulp.dest('www')); });

如何防止Gulp输出缓冲

Gulp似乎以某种方式缓冲输出,这意味着如果我在我的任务开始时有console.log() ,那么在它完成之后,会有一些长时间运行的操作和console.log() ,这两个日志将显示在控制台同时(在任务结束时)。 第一个问题: 这是行为预期还是可能有什么问题,我的设置? 第二: 一旦达到console.log()语句,我可以强制Gulp / Node打印到控制台吗?

使用browserify对js文件进行版本控制,以防止客户端使用旧的js文件

我已经开始使用browserify而不是requirejs,在requirejs上我可以在config中使用urlArgs,当我更改js代码时给出新的版本号。 以便浏览器不会使用先前caching的js文件。 我couldntfind如何添加这个。 这是我现在的大嘴文件, ….. gulp.task('browserify', function () { var browserified = transform(function(filename) { var b = browserify(filename); return b.bundle(); }); return gulp.src(['./js/main.js']) .pipe(browserified) // .pipe(uglify()) // commented out on testing environment. .pipe(gulp.dest('./dist/js')); }); …. gulp.task('html', function() { return gulp.src('./src/index.html') .pipe(htmlreplace({ 'css': 'css/main.css', 'js': { src: [ … // infrastructural js files / plugins 'js/main.js' […]

有没有办法通过依赖复制资产到一个项目?

我目前正在开发一个npm模块,我会把它作为一个依赖项引入到我的应用程序中。 这个模块本质上是一个共享的Gulp实例。 我有这种设置的方式,我想能够在安装依赖项之后将Gulpfile.js复制到应用程序的根目录中。 有没有办法做到这一点( postinstall也许)? 有没有更好的方法去做这件事? 例: 应用程序 : npm install mySharedGulp * mySharedGulp安装* * postinstall脚本将mySharedGulp中的 Gulpfile.js复制到应用程序根目录中。* *用户可以运行GULP命令没有问题*

将包名称传递给Gulp任务

将Package.json名称传递给Gulp任务是否可行? 比如,像这样的东西: <%= pkg.name %>