How to get it to work with Gulp and Ripple Emulator?
I've tried various options and finally ended up with the following confusing version of gulpfile.js, but I just can't get it to work :(.
I am using npm package emulation instead of Chrome plugin. This will start the emulator and everything works except for the liver load (manual update works though).
var gulp = require('gulp');
var path = require('path');
var o = require('open');
var ripple = require('ripple-emulator');
var connect = require('gulp-connect');
var injectReload = require('gulp-inject-reload');
var webPath = function(p) {
return path.join('./www/', p);
};
gulp.task('connect', function() {
connect.server({
root: 'www',
livereload: true
});
});
gulp.task('html', function() {
gulp.src('./www/*.html')
.pipe(injectReload({
host: 'http://localhost'
}))
.pipe(gulp.dest(webPath('build')))
.pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch(['./www/*.html'], ['html']);
});
// The default task
gulp.task('default', ['connect', 'watch'], function() {
var options = {
keepAlive: false,
open: true,
port: 4400
};
// Start the ripple server
ripple.emulate.start(options);
if (options.open) {
o('http://localhost:' + options.port + '?enableripple=true');
}
});
The dependencies I am using.
// package.json
{
"name": "servicepromobile",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"gulp": "latest",
"open": "latest",
"ripple-emulator": "latest",
"gulp-livereload": "^2.1.1",
"connect-livereload": "^0.5.0",
"tiny-lr": "^0.1.4",
"gulp-connect": "^2.0.6",
"gulp-inject-reload": "0.0.2"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test"
}
}
+3
source to share
No one has answered this question yet
Check out similar questions: