Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 17, 2016
1 parent 06d6d42 commit cf770fe
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
21 changes: 21 additions & 0 deletions bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, function () { 'use strict';

function cube ( x ) {
return x * x * x;
}

function a(y){
return cube(y) + 55
}

console.log( cube( 5 ) ); // 125
console.log( a( 5 ) ); // 125


// var v = new validator();

}));
10 changes: 9 additions & 1 deletion dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ function cube ( x ) {
return x * x * x;
}

console.log( cube( 5 ) ); // 125
function a(y){
return cube(y) + 55
}

console.log( cube( 5 ) ); // 125
console.log( a( 5 ) ); // 125


// var v = new validator();
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var rollup = require('rollup').rollup;
var commonjs = require('rollup-plugin-commonjs');
var nodeResolve = require('rollup-plugin-node-resolve');

gulp.task('script', function () {
gulp.task('default', function () {
return rollup({
entry: 'src/main.js',
plugins: [
Expand All @@ -15,7 +15,7 @@ gulp.task('script', function () {
// 输出 bundle + sourcemap
var result = bundle.generate({
// output format - 'amd', 'cjs', 'es6', 'iife', 'umd'
format: 'cjs'
format: 'umd'
});

fs.writeFileSync( 'bundle.js', result.code );
Expand Down
6 changes: 6 additions & 0 deletions src/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { cube } from './maths.js';


export function a(y){
return cube(y) + 55
}
8 changes: 7 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
// import { validator } from 'validator.tool';
import { cube } from './maths.js';
console.log( cube( 5 ) ); // 125
import { a } from './a.js';
console.log( cube( 5 ) ); // 125
console.log( a( 5 ) ); // 125


// var v = new validator();
11 changes: 11 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<script type="text/javascript" src="../dist/main.js"></script>
</head>
<body>

</body>
</html>

0 comments on commit cf770fe

Please sign in to comment.