├── .babelrc ├── .gitignore ├── README.md ├── dist └── bundle.js ├── gulpfile.babel.js ├── index.html ├── package.json └── src ├── app.js └── flash-message.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: ["es2015"] 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Babel with Gulp 2 | 3 | Starter code for transpiling ES2015 (including modules) with Babel, Gulp and Browserify. 4 | 5 | 6 | # Installing 7 | 8 | 1. Clone the repo 9 | 2. `npm install -g gulp` to install Gulp globally. 10 | 3. `npm install` to resolve project dependencies. 11 | 12 | # Using 13 | 14 | Run `gulp` from the command line and you are good to go! 15 | 16 | The project is currently setup to transpile code under the _/src_ folder using the 17 | _/src/app.js_ file as an entry point. 18 | 19 | -------------------------------------------------------------------------------- /dist/bundle.js: -------------------------------------------------------------------------------- 1 | (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 { 6 | 7 | return browserify("src/app.js") 8 | .transform("babelify") 9 | .bundle() 10 | .pipe(source("bundle.js")) 11 | .pipe(gulp.dest("dist")); 12 | 13 | }); 14 | 15 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Babel with Gulp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-with-gulp", 3 | "version": "1.0.0", 4 | "description": "Starter code for using Babel with Gulp", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Carlos Souza (http://csouza.me/)", 10 | "license": "ISC", 11 | "repository": { 12 | "type": "git", 13 | "url": "git+ssh://git@github.com/codeschool/babel-with-gulp.git" 14 | }, 15 | "keywords": [ 16 | "babel", 17 | "gulp", 18 | "es2015" 19 | ], 20 | "bugs": { 21 | "url": "https://github.com/codeschool/babel-with-gulp/issues" 22 | }, 23 | "homepage": "https://github.com/codeschool/babel-with-gulp#readme", 24 | "devDependencies": { 25 | "babel-preset-es2015": "^6.1.18", 26 | "babelify": "^7.2.0", 27 | "browserify": "^12.0.1", 28 | "gulp": "^3.9.0", 29 | "vinyl-source-stream": "^1.1.0" 30 | }, 31 | "dependencies": { 32 | "babel-core": "^6.1.21" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | import FlashMessage from "./flash-message"; 2 | 3 | let flash = new FlashMessage("Hello from ES2015, Babel and Gulp!"); 4 | flash.display(); 5 | 6 | -------------------------------------------------------------------------------- /src/flash-message.js: -------------------------------------------------------------------------------- 1 | class FlashMessage { 2 | constructor(message){ 3 | this.message = message; 4 | } 5 | 6 | display(){ 7 | alert(this.message); 8 | } 9 | } 10 | 11 | export default FlashMessage; 12 | --------------------------------------------------------------------------------