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
'use strict'; | |
var config = { | |
sass : { | |
errLogToConsole: true, | |
outputStyle: 'compressed' | |
}, | |
bower: './bower_components', | |
source: { | |
main: '.src/', | |
html:{ |
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
// lib/math.js | |
export function sum(x, y) { | |
return x + y; | |
} | |
// app.js | |
import * as math from "lib/math"; | |
console.log("2π = " + math.sum(math.pi, math.pi)); |
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
npm init && npm i --save-dev browserify |
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
npm i --save bluebird |
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
scripts:{ | |
"build": "browserify index.js > main.js" | |
} |
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
//index.js | |
var doSomething = require(‘./dosomething’) | |
console.log(‘doSomething’, doSomething); |
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
//doSomething.js | |
var Promise = require(‘bluebird’) | |
module.exports = function(a, b){ | |
var p = new Promise() | |
if(a > b) | |
p.reject() | |
p.resolve() | |
} |
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
npm run-script build |
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
<script type=”text/javascript” src=”./main.js”></script> |
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
//doSomething.js > es6 | |
import Promise from 'bluebird' | |
export default (a, b) => { | |
let p = new Promise() | |
if(a > b) | |
p.reject() | |
p.resolve() | |
} |
OlderNewer