Tag: gulp

咕嘟声错误:无法find模块browserify

运行gulp时得到上述错误。 无法弄清楚为什么。 我读过一些东西,如gulp.src需要一个./ infront的应用程序。 var gulp = require('gulp'), browserify = require('gulp-browserify'); gulp.task('scripts', function () { gulp.src(['./app/main.js']) .pipe(browserify({ debug: true, transform: [ 'reactify' ] })) .pipe(gulp.dest('./public/')); }); gulp.task('default', ['scripts']); 像这样.. 我已经做了npm安装,所以节点模块是应该在哪里。 它值得在节点模块中指出它被称为gulp-browserify。 以及我已经在我的Mac上安装了全球范围的browserify。 让我知道你的想法,或者是否有任何信息丢失。 我是新的反应,并试图从字面上设置node.js作为后端,并创build一个反应的环境。

gulp-concat抛出exception'file.isNull(),index.js:39 TypeError:file.isNull不是函数

我试图用gulp编译react(.jsx),coffeescript(.coffee)和vanilla javascript(.js)文件,将所有生成的.js文件打包到一个文件中,app.js被加载到我的索引中.html页面。 我正在为每个编译types生成一个stream,并使用merge-stream将3个馈线stream的内容收集到一个stream中,我将这个stream传递给gulp-concat来创buildapp.js. 我得到一个来自gulp-concat,index.js,第39行的exception,让我知道“文件”不是一个函数。 这里是我的整个gulpfile.js,对gulp-concat的引用接近本节的底部。 var browserify = require('browserify'); var coffee = require('gulp-coffee'); var concat = require('gulp-concat'); var gulp = require('gulp'); var gutil = require('gulp-util'); var mergeStream = require('merge-stream'); var reactify = require('reactify'); var sass = require('gulp-sass'); var source = require('vinyl-source-stream'); gulp.task('javascript', function(){ // convert .jsx files to .js, collecting them in a stream var […]

Angularjs从express.js的“public”文件夹的“views”文件夹中路由ejs静态文件

这是我的项目结构。 我试图从“public”文件夹中的angular度路由文件(app> public> main.js)中的“views”文件夹中调用ejs文件(app> views> list.ejs)。 但list.ejs不加载。 /************main.js****************/ var fsApp=angular.module('chart-app'); fsApp.config(function($routeProvider) { $routeProvider .when('/', { templateUrl: 'list.ejs', controller: 'listCtrl' }) /*In my server.js server file I am calling the files in public folder this way: */ app.use('/static',express.static(__dirname + '/public')); app.get('/',function(req,res){ res.render('index.ejs'); }); <!–In index.ejs (where my <ng-view></ng-view> is) I am including the link for static […]

使用gulp-compass时出现“spawn / usr / bin / compass ENOENT”

我试图运行下面的Gulp任务来编译Sass文件,使用OS X Yosemite 10.5.5上的插件gulp-compass。 var path = require("path"); var gulp = require("gulp"); var compass = require("gulp-compass"); gulp.task("compile2013Base", function() { var projectPath = path.join(__dirname, '../../ '); gulp.src(['../sass/desktop/css/2013/*.scss']).pipe(compass({ project: projectPath, css: 'htdocs/assets/css/2013/', sass: 'sass/desktop/css/2013' })).on('error', errorHandler).pipe(gulp.dest('../../htdocs/assets/css/2013/')); }); function errorHandler (error) { console.log(error.toString()); this.emit('end'); } 但是,当我尝试运行像gulp compile2013Base这样的任务时,出现以下错误: > gulp compile2013Base [13:39:06] Using gulpfile [**redacted**]/scripts/js/gulpfile.js [13:39:06] Starting 'compile2013Base'… [13:39:06] […]

gulp.js – dest.on不是一个函数

我试图编译我的styles.scss与styles.scss gulp-sass当我收到以下错误: [09:48:49] Starting 'e'… [09:48:49] 'e' errored after 2.35 ms [09:48:49] TypeError: dest.on is not a function at DestroyableTransform.Readable.pipe (D:\Data\Web Development\Repositories\ds-www\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:485:8) at Gulp.<anonymous> (D:\Data\Web Development\Repositories\ds-www\gulpfile.js:44:6) at module.exports (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\index.js:214:10) at D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\index.js:279:18 at finish (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\lib\runTask.js:21:8) at module.exports (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\lib\runTask.js:60:3) at Gulp.Orchestrator._runTask (D:\Data\Web Development\Repositories\ds-www\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep […]

找不到模块'.tmp / Rx.min.js'

我有Ubuntu操作系统16.04版本和节点:V6.6.0 Npm:3.10.3 我正在尝试使用gulpconfiguration项目来获取一个常见问题 错误消息:无法find模块'.tmp / Rx.min.js' 我正在运行下面的命令来build立gulp环境: npm run build.dev 你可以在这张图中看到错误信息: https : //i.stack.imgur.com/BQKRW.png

将asynchronous函数的输出传递给gulp.dest?

在我的gulp任务中,我只需要将从前一个任务获得的文件复制到我必须在运行时使用asynchronous函数(因为我使用fs函数)来确定的destpath。 我该怎么做呢? 如何将asynchronous函数的结果提供给gulp.dest指令? 示例代码: function getDest() { fs.readdir('my/path', function(error, contents) { // pick the right one return the_right_one; }) } gulp.task('copy-stuff', ['previous-task'], function() { return gulp.src('some/file').pipe(gulp.dest(getDest())); })

Gulp任务没有串联运行

我正在关注官方文档,但是我的大量任务没有连续运行。 gulp.task("mytask", ["foo", "bar", "baz"]); gulp.task("foo", function (callback) { gulp .src("…") .pipe(changed("…")) .pipe(gulp.dest(function (file) { // …stuff return "…"; })) .on("end", function() { // …stuff callback(); }); }); gulp.task("bar", function (callback) { //… }); gulp.task("baz", function (callback) { //… }); 但是我的输出如下所示: Starting 'mytask'… Starting 'foo'… Starting 'bar'… // <– foo is not done yet! Finished […]

Karma public api缺lessconfigFile选项

gulp-karmabuild议像这样的外部configuration文件: module.exports = { basePath: '', singleRun: true }; 我想要一个像这样的外部configuration文件(grunt-karma风格): module.exports = function(config) { config.set({ basePath: '', singleRun: true }); }; 如何使用proper config file与业力API。 细节: 我正在使用gulp-karma,正如前面提到的那样,我必须自己实施。 Karma API非常简单: var server = require('karma').server; server.start(config, done); configvariables是模糊的。 这是一个简单的configuration对象: var config = { basePath: '', singleRun: true // … } 让我们来看看grunt-karma: 示例grunt-karmaconfiguration: karma: { unit: { configFile: 'karma.conf.js' […]

有没有办法在Gulp中将.css与.less合并?

到目前为止,我没有find解决办法。 以下是我现在想到的: var gulp = require('gulp'); var concat = require('gulp-concat'); var uncss = require('gulp-uncss'); var minifyCSS = require('gulp-minify-css'); var concatCss = require('gulp-concat-css'); var less = require('gulp-less'); var stripCssComments = require('gulp-strip-css-comments'); gulp.task('css', function() { return gulp.src('css/*.css') .pipe(stripCssComments({all:true})) .pipe(concat('plugins.css')) .pipe(uncss({html: ['index.html']})) .pipe(minifyCSS()) .pipe(gulp.dest('build/css')); }); gulp.task('less', function() { return gulp.src('css/*.less') .pipe(less()) .pipe(stripCssComments({all:true})) .pipe(concat('styles.css')) .pipe(uncss({html: ['index.html']})) .pipe(minifyCSS()) .pipe(gulp.dest('build/css')); }); […]