Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
Initial working code
Browse files Browse the repository at this point in the history
  • Loading branch information
caike committed Nov 16, 2015
0 parents commit d0a6edc
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
presets: ["es2015"]
}
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
17 changes: 17 additions & 0 deletions README.md
@@ -0,0 +1,17 @@
# Babel with Gulp

Starter code for using Babel with Gulp to transpile ES2015.

# Installing

1. Clone the repo
2. `npm install -g gulp` to install Gulp globally.
3. `npm install` to resolve project dependencies.

# Using

Run `gulp` from the command line and you are good to go!

The project is currently setup to transpile code under the _/src_ folder using the
_/src/app.js.es6_ file as an entry point.

43 changes: 43 additions & 0 deletions dist/bundle.js
@@ -0,0 +1,43 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

var _flashMessage = require("./flash-message");

var _flashMessage2 = _interopRequireDefault(_flashMessage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var flash = new _flashMessage2.default("Hello from ES2015, Babel and Gulp!");
flash.display();

},{"./flash-message":2}],2:[function(require,module,exports){
"use strict";

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

Object.defineProperty(exports, "__esModule", {
value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var FlashMessage = (function () {
function FlashMessage(message) {
_classCallCheck(this, FlashMessage);

this.message = message;
}

_createClass(FlashMessage, [{
key: "display",
value: function display() {
alert(this.message);
}
}]);

return FlashMessage;
})();

exports.default = FlashMessage;

},{}]},{},[1]);
14 changes: 14 additions & 0 deletions gulpfile.babel.js
@@ -0,0 +1,14 @@
import gulp from "gulp";
import browserify from "browserify";
import source from "vinyl-source-stream";

gulp.task("default", () => {

return browserify("src/app.js.es6")
.transform("babelify", {presets: ["es2015"]})
.bundle()
.pipe(source("bundle.js"))
.pipe(gulp.dest("dist"));

});

10 changes: 10 additions & 0 deletions index.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Babel with Gulp</title>
</head>
<body>
<script src="dist/bundle.js"></script>
</body>
</html>
34 changes: 34 additions & 0 deletions package.json
@@ -0,0 +1,34 @@
{
"name": "babel-with-gulp",
"version": "1.0.0",
"description": "Starter code for using Babel with Gulp",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Carlos Souza <carloshrsouza@gmail.com> (http://csouza.me/)",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/codeschool/babel-with-gulp.git"
},
"keywords": [
"babel",
"gulp",
"es2015"
],
"bugs": {
"url": "https://github.com/codeschool/babel-with-gulp/issues"
},
"homepage": "https://github.com/codeschool/babel-with-gulp#readme",
"devDependencies": {
"babel-preset-es2015": "^6.1.18",
"babelify": "^7.2.0",
"browserify": "^12.0.1",
"gulp": "^3.9.0",
"vinyl-source-stream": "^1.1.0"
},
"dependencies": {
"babel-core": "^6.1.21"
}
}
5 changes: 5 additions & 0 deletions src/app.js.es6
@@ -0,0 +1,5 @@
import FlashMessage from "./flash-message";

let flash = new FlashMessage("Hello from ES2015, Babel and Gulp!");
flash.display();

11 changes: 11 additions & 0 deletions src/flash-message.js
@@ -0,0 +1,11 @@
class FlashMessage {
constructor(message){
this.message = message;
}

display(){
alert(this.message);
}
}

export default FlashMessage;

0 comments on commit d0a6edc

Please sign in to comment.