Tag: plugin

无法获得gulp-ejs将EJS编译为.html

嗨即时通讯使用gulp来自动化我的.ejs文件编译成html文件,但是当gulp-ejs编译文件,它作为ejs它。 我需要在ejs()对象中定义.html扩展名,但是我可以让它工作。 这是我到目前为止: gulp.task('ejs', function(){ return gulp.src('src/templates/**/*.ejs') .pipe(ejs()) .pipe(gulp.dest('builds/dev/')) }); 我也试过这个: gulp.task('ejs', function(){ return gulp.src('src/templates/**/*.ejs') .pipe(ejs({setting: '.html'})) .pipe(gulp.dest('builds/dev/')) }); Br M

NodeJS不返回Elasticsearch / Mongoosastic的结果

我试图创build一个简单的search表单来search一个模型(产品)。 这里是我使用Mongoosastic的产品模型: var ProductSchema = new Schema({ category: { type: Schema.Types.ObjectId, ref: 'Category'}, name: String, price: Number, image: String, description: String }); ProductSchema.plugin(mongoosastic, { hosts: [ 'localhost:9200' ] }); 我将ElasticSearch与Product model连接起来,如下所示: Product.createMapping(function (err, mapping) { if (err) { console.log("error creating mapping"); console.log(err); } else { console.log("Mapping created"); console.log(mapping); } }); var stream = Product.synchronize(); var […]