mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-03-11 21:38:38 +01:00
added livereload, restructured files
This commit is contained in:
parent
92952711cb
commit
ecc9d00d1d
20
gulpfile.js
20
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' ])
|
||||
|
@ -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))
|
||||
|
@ -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",
|
||||
|
@ -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()
|
||||
}
|
||||
})
|
||||
|
7
webapp/app.jsx
Normal file
7
webapp/app.jsx
Normal file
@ -0,0 +1,7 @@
|
||||
var React = require('react')
|
||||
var ReactDOM = require('react-dom')
|
||||
|
||||
ReactDOM.render(
|
||||
<h1>Hello, world!</h1>,
|
||||
document.getElementById('container')
|
||||
);
|
@ -3,7 +3,7 @@
|
||||
<title>IPFS Board</title>
|
||||
</head>
|
||||
<body>
|
||||
Loading...
|
||||
<div id="container">Loading...</div>
|
||||
<script src="/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user