SlideShare a Scribd company logo
1 of 28
Download to read offline
Nir@500tech.com
ES6 up & running
how to setup an ES6 environment
Nir@500tech.com
Nir Kaufman
+
Head of AngularJS development @ 500Tech
We develop, consult & train AngularJS
for startups & enterprises
Join us!
We’re hiring
Nir@500tech.com
grab the code
http://tinyurl.com/l5rpord
https://github.com/nirkaufman/es6-up-and-running
Nir@500tech.com
https://kangax.github.io/compat-table/es6/
ES6 current state
Edge 72%
FireFox 68%
io.js 43%
Node 23%
Babel 76%
Traceur 60%
Browsers Server Compilers
Nir@500tech.com
our goal:
minimal effort
easy tools to get us up and running fast
Nir@500tech.com
1
choose your editor
syntax highlighting, code completion etc…
Nir@500tech.com
1. go to preference -> javascript -> languages & frameworks
2. choose ECMAScript 6
Nir@500tech.com
Sublime Text
1. install package control
2. go to install packages
3. search for javascript next and install
4. switch language to javascript next
Nir@500tech.com
2
choose your compiler
make your ES6 code compatible with current browsers
Nir@500tech.com
Babel vs Traceur
two popular javascript compilers.
both of them will do the work.
you can easily switch for any reason at any stage
Nir@500tech.com
• supports 76% of ES6 features (currently)
• support all major build systems (grunt, gulp etc..)
• supports frameworks (Ember, Meteor, Sails etc…)
http://babeljs.io/docs/using-babel/
Nir@500tech.com
CLI
npm install -g babel
babel src --out-dir lib
babel src.js --out-file compiled.js
compile single file:
compile directory:
--watch
watch for changes:
--source-maps
add source maps:
+
Nir@500tech.com
WebStorm
set up a file watcher with Babel template:
+
Nir@500tech.com
Gulp
npm install --save-dev gulp-babel
var babel = require("gulp-babel");
gulp.task("default", function () {
return gulp.src(“src/**/*.js”)
.pipe(babel())
.pipe(gulp.dest("dist"));
});
es6-up-and-running/gulpfile.js
+
Nir@500tech.com
• supports 60% of ES6 features
• supports all major build systems (grunt, gulp etc..)
• maintained by Google
https://github.com/google/traceur-compiler
Nir@500tech.com
3
pick a module system
if you already use one just integrate with it..
Nir@500tech.com
JS modules
modules are now a part of the javascript language.
but until now we used other solutions to achieve modularity
UMD
each solution use it’s own patterns & syntax
Nir@500tech.com
ES6 modules
overview of the ES6 module syntax:
Named exports
(several per module)
Default exports
(one per module)
export class Logger {. . .}
export const ID = 123456;
export function sum () {. . .}
import { Logger } from ‘./utils’;
import { ID, sum } from ‘./utils’;
import * as utils from ‘./utils’;
export default class Logger {. . .}
import Logger from ‘./utils’;
Nir@500tech.com
if you already use
modules in your app
you can still use the ES6 modules syntax.
just let babel know which format to use.
https://babeljs.io/docs/usage/modules/
Nir@500tech.com
if you are starting
a new fresh project
you need to know about some tools…
Nir@500tech.com
“webpack takes modules with dependencies and
generates static assets representing those modules”.
http://webpack.github.io/
Nir@500tech.com
1. npm install -g webpack
2. npm install -g webpack-dev-server
3. npm install -D babel-loader
4. include the babel-loader in webpack.config.js
5. run webpack to bundle your files
6. run webpack-dev-server and relax…
es6-up-and-running/webpack.config.js
Nir@500tech.com
“jspm is a package manager for the SystemJS universal
module loader, built on top of the dynamic ES6 module
loader”
http://jspm.io/
Nir@500tech.com
1. npm install -g jspm
2. jspm init
3. npm install <something from anywhere>
4. load system.js & config.js in your HTML
5. import your entry file and relax..
es6-up-and-running/src/index.html
Nir@500tech.com
what to choose?
both of the tools are easy to use.
both of them offer a bundling feature for production.
webpack offers more build
features that can replace gulp or
grunt in your project
JSPM makes package management
and module loading easy and
painless, you will need gulp
for other tasks
Nir@500tech.com
4
migration to ES6
refactor your current javascript code to ES6
Nir@500tech.com
step by step
1. start with modules.
2. replace var with let & const. easy and fast.
3. convert your constructor functions to classes.
4. include more & more ES6 features with ease…
ES6 & 5.1 can be mixed without problems.
No need to refactor everything at once.!
Nir@500tech.com
Thank you!
Q&A

More Related Content

What's hot

What's hot (20)

Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
Angular 5
Angular 5Angular 5
Angular 5
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
AngularJS2 / TypeScript / CLI
AngularJS2 / TypeScript / CLIAngularJS2 / TypeScript / CLI
AngularJS2 / TypeScript / CLI
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new framework
 
Angular EE - Special Workshop by Nir Kaufman
Angular EE - Special Workshop by Nir KaufmanAngular EE - Special Workshop by Nir Kaufman
Angular EE - Special Workshop by Nir Kaufman
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
 
The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2
 
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
 
Angular 2.0: Getting ready
Angular 2.0: Getting readyAngular 2.0: Getting ready
Angular 2.0: Getting ready
 

Viewers also liked

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 

Viewers also liked (20)

Webpack and angularjs
Webpack and angularjsWebpack and angularjs
Webpack and angularjs
 
Data Structures in javaScript 2015
Data Structures in javaScript 2015Data Structures in javaScript 2015
Data Structures in javaScript 2015
 
Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016
 
redux and angular - up and running
redux and angular - up and runningredux and angular - up and running
redux and angular - up and running
 
Solid angular
Solid angularSolid angular
Solid angular
 
Angular Pipes Workshop
Angular Pipes WorkshopAngular Pipes Workshop
Angular Pipes Workshop
 
How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
Webstorm
WebstormWebstorm
Webstorm
 
Js objects
Js objectsJs objects
Js objects
 
JavaScript Tools and Implementation
JavaScript Tools and ImplementationJavaScript Tools and Implementation
JavaScript Tools and Implementation
 
JavaScript Variables
JavaScript VariablesJavaScript Variables
JavaScript Variables
 
JavaScript: Values, Types and Variables
JavaScript: Values, Types and VariablesJavaScript: Values, Types and Variables
JavaScript: Values, Types and Variables
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Angular redux
Angular reduxAngular redux
Angular redux
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
 
Game is ggj2017 presentation
Game is ggj2017 presentationGame is ggj2017 presentation
Game is ggj2017 presentation
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to Up & running with ECMAScript6

OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
Odoo
 

Similar to Up & running with ECMAScript6 (20)

Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 
Django framework
Django framework Django framework
Django framework
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
 
React django
React djangoReact django
React django
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
 
The Hacking Games - A Road to Post Exploitation Meetup - 20240222.pptx
The Hacking Games - A Road to Post Exploitation Meetup - 20240222.pptxThe Hacking Games - A Road to Post Exploitation Meetup - 20240222.pptx
The Hacking Games - A Road to Post Exploitation Meetup - 20240222.pptx
 
Full Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication SystemFull Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication System
 
AWS ML Model Deployment
AWS ML Model DeploymentAWS ML Model Deployment
AWS ML Model Deployment
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in Python
 
Cypress.pptx
Cypress.pptxCypress.pptx
Cypress.pptx
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntBuilding a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger Hunt
 

More from Nir Kaufman

More from Nir Kaufman (9)

Angular Prestige: Less-known API and techniques
Angular Prestige: Less-known API and techniquesAngular Prestige: Less-known API and techniques
Angular Prestige: Less-known API and techniques
 
Angular CLI custom builders
Angular CLI custom buildersAngular CLI custom builders
Angular CLI custom builders
 
Electronic music 101 for developers
Electronic music 101 for developersElectronic music 101 for developers
Electronic music 101 for developers
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Redux pattens - JSHeroes 2018
Redux pattens - JSHeroes 2018Redux pattens - JSHeroes 2018
Redux pattens - JSHeroes 2018
 
Boosting Angular runtime performance
Boosting Angular runtime performanceBoosting Angular runtime performance
Boosting Angular runtime performance
 
Decorators in js
Decorators in jsDecorators in js
Decorators in js
 
Styling recipes for Angular components
Styling recipes for Angular componentsStyling recipes for Angular components
Styling recipes for Angular components
 
Introduction To Angular's reactive forms
Introduction To Angular's reactive formsIntroduction To Angular's reactive forms
Introduction To Angular's reactive forms
 

Recently uploaded

Recently uploaded (20)

BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST API
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 

Up & running with ECMAScript6