Skip to content

Instantly share code, notes, and snippets.

@iktakahiro
Last active May 11, 2016 12:26
Show Gist options
  • Save iktakahiro/6c13d181a2962ed1d2b1 to your computer and use it in GitHub Desktop.
Save iktakahiro/6c13d181a2962ed1d2b1 to your computer and use it in GitHub Desktop.
JavaScript のモダン開発環境を求めて 〜 前編・Riot.js 導入まで ref: http://qiita.com/iktakahiro/items/b0bcb37a61293b36af9e
# nodebrew のインストール
brew install nodebrew
# Node.js のインストール
mkdir -p ~/.nodebrew && cd ~/.nodebrew
nodebrew install-binary stable # stable は v4.2.1 などでも可
# PATH を登録し、アクティブにする
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
nodebrew use stable # stable は v4.2.1 などでも可
# npm を使った必要パッケージのグローバルインストール
npm install -g gulp babel bower
mkdir my-project && cd my-project
# 必要パッケージのローカルインストール
npm install gulp gulp-riot babel babel-core
# Riot.js の導入
bower install riot
import gulp from 'gulp';
import riot from 'gulp-riot';
gulp.task('riot', () => {
gulp.src('sample_list.tag')
.pipe(riot())
.pipe(gulp.dest('dest'));
});
riot.tag('list', '<h2>{ opts.heading }</h2> <ul> <li each="{ item, i in items }">{ item }</li> </ul>', function(opts) {
const PI = 3.1415;
this.items = ['One', 'Two', PI];
});
<list>
<h2>{ opts.heading }</h2>
<ul>
<li each={ item, i in items }>{ item }</li>
</ul>
<script>
const PI = 3.1415;
this.items = ['One', 'Two', PI];
</script>
</list>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment