diff --git a/gulpfile.js b/gulpfile.js index e33b325..aac7f1c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,13 +6,14 @@ var browserify = require('browserify') var reactify = require('reactify') // Transforms React JSX to JS var uglify = require('gulp-uglify') var clean = require('gulp-clean') +var connect = require('gulp-connect') var config = { files: { + mainJs: 'webapp/app.jsx', css: 'webapp/*.css', - js: 'webapp/*.js', - html: 'webapp/*.html', - mainJs: 'webapp/app.js' + js: ['webapp/*.js','webapp/*.jsx'], + html: 'webapp/*.html' }, dest: 'webapp/dist/' } @@ -21,11 +22,13 @@ gulp.task('css',function(){ gulp.src(config.files.css) .pipe(minifyCss()) .pipe(gulp.dest(config.dest)) + .pipe(connect.reload()) }) gulp.task('html',function(){ gulp.src(config.files.html) .pipe(gulp.dest(config.dest)) + .pipe(connect.reload()) }) gulp.task('js',function(){ @@ -37,6 +40,7 @@ gulp.task('js',function(){ .pipe(buffer()) // do this or uglify won't work .pipe(uglify()) .pipe(gulp.dest(config.dest)) + .pipe(connect.reload()) }) gulp.task('clean',function(){ @@ -44,10 +48,18 @@ gulp.task('clean',function(){ .pipe(clean()) }) +gulp.task('serve',function(){ + connect.server({ + root: config.dest, + port: 9090, + livereload: true + }); +}) + gulp.task('watch',function(){ gulp.watch(config.files.js,['js']) gulp.watch(config.files.html,['html']) gulp.watch(config.files.css,['css']) }) -gulp.task('default', [ 'html', 'css', 'js', 'watch' ]) +gulp.task('default', [ 'html', 'css', 'js', 'watch', 'serve' ]) diff --git a/lib/boards-api-http.js b/lib/boards-api-http.js index e203d90..44a7b83 100644 --- a/lib/boards-api-http.js +++ b/lib/boards-api-http.js @@ -27,7 +27,7 @@ module.exports = function(boards,options){ options = options || {} // Serve web app - app.use(express.static(__dirname+'/../webapp')) + app.use(express.static(__dirname+'/../webapp/dist/')) app.get('/@:user',(req,res) => { boards.getProfile(req.params.user,apiToHandler(req,res)) diff --git a/package.json b/package.json index 16d6634..0b03f7e 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "express": "^4.13.3", "gulp": "^3.9.0", "gulp-clean": "^0.3.1", + "gulp-connect": "^2.2.0", "gulp-minify-css": "^1.2.1", "gulp-uglify": "^1.5.1", "ipfs-api": "^2.6.2", diff --git a/server/server.js b/server/server.js index 330c205..c64b3cd 100755 --- a/server/server.js +++ b/server/server.js @@ -12,7 +12,7 @@ boards.init(function(err){ console.log(err) } else { server = BoardsAPIHttp(boards) - setInterval(boards.searchUsers.bind(boards),3 * 60 * 1000) - boards.searchUsers() + // setInterval(boards.searchUsers.bind(boards),3 * 60 * 1000) + // boards.searchUsers() } }) diff --git a/webapp/app.js b/webapp/app.js deleted file mode 100644 index e69de29..0000000 diff --git a/webapp/app.jsx b/webapp/app.jsx new file mode 100644 index 0000000..d79d9f0 --- /dev/null +++ b/webapp/app.jsx @@ -0,0 +1,7 @@ +var React = require('react') +var ReactDOM = require('react-dom') + +ReactDOM.render( +

Hello, world!

, + document.getElementById('container') +); diff --git a/webapp/index.html b/webapp/index.html index d5db752..f7d97d4 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -3,7 +3,7 @@ IPFS Board - Loading... +
Loading...