This repository has been archived by the owner on Jul 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d0a6edc
Showing
9 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
presets: ["es2015"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")); | ||
|
||
}); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import FlashMessage from "./flash-message"; | ||
|
||
let flash = new FlashMessage("Hello from ES2015, Babel and Gulp!"); | ||
flash.display(); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class FlashMessage { | ||
constructor(message){ | ||
this.message = message; | ||
} | ||
|
||
display(){ | ||
alert(this.message); | ||
} | ||
} | ||
|
||
export default FlashMessage; |