Last active
January 7, 2017 14:40
-
-
Save shrunyan/62efd4f34a396d65c85f to your computer and use it in GitHub Desktop.
Example Gulp build for Riotjs + ES6 + Browserify + Babelify + Riotify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './app.tag' | |
riot.mount('#app', 'app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./dashboard.tag') | |
<app> | |
<section id="main"> | |
<h1>Total EcoSystem Pageviews</h1> | |
<dashboard></dashboard> | |
</section> | |
</app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./dashboard-graph.tag') | |
<dashboard> | |
<dashboard-graph ecosystem={ecosystem}></dashboard-graph> | |
<script type="es6"> | |
import moment from 'moment' | |
this.ecosystem = 1 | |
this.on('mount', () => { | |
Z.dispatcher.on('set:ecosystem', (ecosystem) => { | |
this.update({ecosystem}) | |
}) | |
}) | |
</script> | |
</dashboard> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp') | |
var browserify = require('browserify') | |
var watchify = require('watchify') | |
var riotify = require('riotify') | |
var babelify = require('babelify') | |
var source = require('vinyl-source-stream') | |
gulp.task('bundle:app', function () { | |
var b = browserify(watchify.args) | |
b.external(VENDORS) | |
b.add(APP_ENTRY) | |
b.transform(babelify) | |
b.transform(riotify) | |
b.bundle() | |
.pipe(source('bundle.js')) | |
.pipe(buffer()) | |
.pipe(gulp.dest(BUILD)) | |
return b | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>EcoSystem Dashboard</title> | |
<link rel="stylesheet" href="main.css" media="screen" /> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script type="text/javascript" src="bundle.js"></script> | |
</body> | |
</html> |
buffer()
is probably var buffer = require('vinyl-buffer');
+1 maadborn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
type="es6
attribute on the script tag causes riot to use babel when compiling the.tag
file.