1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00

Implemented build system

This commit is contained in:
Enrico Fasoli 2015-11-14 00:57:36 +01:00
parent d4fc72d42f
commit e8716a3cfe
4 changed files with 69 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
example_user/
node_modules/
test/
webapp/dist/

56
gulpfile.js Normal file
View File

@ -0,0 +1,56 @@
var gulp = require('gulp')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var minifyCss = require('gulp-minify-css')
var browserify = require('browserify')
var reactify = require('reactify') // Transforms React JSX to JS
var uglify = require('gulp-uglify')
var clean = require('gulp-clean')
var config = {
files: {
css: 'webapp/*.css',
js: 'webapp/*.js',
html: 'webapp/*.html',
mainJs: 'webapp/app.js'
},
dest: 'webapp/dist/'
}
config.browserify = browserify({
entries: config.files.mainJs,
transform: [ reactify ]
})
gulp.task('css',function(){
gulp.src(config.files.css)
.pipe(minifyCss())
.pipe(gulp.dest(config.dest))
})
gulp.task('html',function(){
gulp.src(config.files.html)
.pipe(gulp.dest(config.dest))
})
gulp.task('js',function(){
config.browserify.bundle()
.on('error', console.error.bind(console))
.pipe(source('app.js')) // do this or browserify won't work
.pipe(buffer()) // do this or uglify won't work
.pipe(uglify())
.pipe(gulp.dest(config.dest))
})
gulp.task('clean',function(){
gulp.src(config.dest, { read: false })
.pipe(clean())
})
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' ])

View File

@ -19,9 +19,17 @@
"author": "Enrico Fasoli (fazo96)",
"license": "MIT",
"dependencies": {
"browserify": "^12.0.1",
"commander": "^2.9.0",
"express": "^4.13.3",
"gulp": "^3.9.0",
"gulp-clean": "^0.3.1",
"gulp-minify-css": "^1.2.1",
"gulp-uglify": "^1.5.1",
"ipfs-api": "^2.6.2",
"moment": "^2.10.6"
"moment": "^2.10.6",
"reactify": "^1.1.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
}
}

View File

@ -1,17 +1,9 @@
<html>
<head>
<title>IPFS Board</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
<!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>-->
<!-- Angular -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js"></script>
<script src="/app.js"></script>
</head>
<body ng-app="boards">
<div ui-view></div>
<body>
Loading...
<script src="/app.js"></script>
</body>
</html>