Skip to content

Instantly share code, notes, and snippets.

View OliverJAsh's full-sized avatar

Oliver Joseph Ash OliverJAsh

View GitHub Profile
/*eslint-env node*/
var jspm = require('jspm');
var builder = new jspm.Builder();
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var System = require('jspm/node_modules/systemjs');
@OliverJAsh
OliverJAsh / foo.scss
Created December 8, 2014 23:07
Sass: re-use class inside media query
@mixin foo {
// styles
}
.foo {
@include foo();
}
@media () {
.bar {
@OliverJAsh
OliverJAsh / app.js
Created November 26, 2014 12:16
jspm server theseus
/* jshint esnext: true */
import { Client } from 'theseus';
console.log(Client);
@OliverJAsh
OliverJAsh / index.html
Last active August 29, 2015 14:10
jspm nodelibs/events
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
/* global System*/
System.import('main');
</script>
@OliverJAsh
OliverJAsh / app.js
Last active August 29, 2015 14:10
jspm server package using node libs
/* jshint esnext: true */
import fs from 'nodelibs/fs';
import childProcess from 'nodelibs/child_process';
console.log(1, fs);
console.log(2, childProcess);
@OliverJAsh
OliverJAsh / foo.md
Last active August 29, 2015 14:09
Build tool requirements

Given a complex dep graph, produce the defined output whilst demonstrating the following capabilities:

  • Intelligent watch. When building a Sass file, e.g. main.scss, the build tool should rebuild if I change any of the files in the dependency graph (e.g. main.scss using Sass’ @import to pull in foo.scss))
  • Piping source maps. E.g.: main.js -> uglify -> concat with foo.js -> bar.js. The output file, bar.js, should have a source map that maps back to main.js
  • Caching. E.g.: main.js -> uglify -> concat with foo.js -> bar.js. Since the last build, foo.js has changed but main.js has not. The build tool should re-use the previous uglify result.

The build tool can be reviewed by the config necessary for achieving the above. Perhaps you could achieve all of these with the naïvest of build tools, but in my opinion, the best tool will have the simplest result: a demonstration of all of the above without any config.

/* jshint esnext: true */
// `getStream` is some third party thing
var stream = getStream();
var events = Rx.fromEvent(stream, 'meta');
stream.write('foo');
// meta event fired by `stream`
stream.write(null);
@OliverJAsh
OliverJAsh / bar.js
Created November 14, 2014 19:24
sandboxed-module test with transitive dependencies
module.exports = 'bar';
@OliverJAsh
OliverJAsh / README.md
Created November 13, 2014 20:38
sandboxed-module test with ES6 source transformer
npm install
node traceur-runner.js main.js
@OliverJAsh
OliverJAsh / bar-es6.js
Created November 13, 2014 20:33
sandboxed-module error with transitive ES6 deps
export default 'bar';