GithubHelp home page GithubHelp logo

elgervb / demo-es6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jspm/demo-es6

0.0 3.0 0.0 1.57 MB

Demonstration of the jspm loader and CLI workflow for ES6 modules

JavaScript 99.98% HTML 0.02%

demo-es6's Introduction

jspm ES6 demo

This demo project demonstrates an ES6 jspm workflow:

  1. Write ES6 modules and load external modules from CDN

    • Clone this repo, and open test.html.
    • This HTML file runs System.import('lib/main').
    • We are dynamically loading jQuery from jspm.io's github endpoint (as defined in config.js), and running an ES6 module load.
    • See lib/main.js and lib/myclass.js for the ES6 module files being loaded dynamically in the browser.
  2. Install external modules locally instead of using CDN versions

    • Install jspm: npm install jspm -g.
    • In the repo, run jspm install.
    • With no arguments, dependencies are installed from the package.json. We could also do jspm install jquery for example.
    • Run jspm setmode local, then open test.html.
    • We are now loading jQuery from the locally installed version, no other configuration or code changes being necessary for this switch.
  3. Bundle into a single file for production

    • Run jspm bundle lib/main --inject.
    • This creates a file build.js containing all dependencies needed for lib/main to run; a source map is also created.
    • --inject adds the bundle definition to config.js; the appropriate bundle is then loaded automatically when a module is requested from it.
    • We could alternatively use <script src="build.js"></script> after SystemJS but before the import.
    • All code is now loaded fully compiled from the single bundle.

https://jspm.io

demo-es6's People

Contributors

djindjic avatar guybedford avatar probins avatar timaschew avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.