Git Product home page Git Product logo

systemjs-starter-kit's Introduction

System.js Starter Project

NPM version Build Status

Dependency Status devDependency Status peerDependency Status

Techniques

Prerequisites

  • node.js (Node 5 with npm 3 is required).
  • gulp (npm install -g gulp)

If you are using different node versions on your machine, use nvm to manage them.

Getting Started

  1. Install the local packages for this demo.
npm install
  1. Run the server, launch the browser, and transpile the ES6 to ES5 using Babel
npm start

Details

The source code is located in the js folder and written in ES6. We use gulp to transpile the ES6 to ES5 using Babel. The npm start command runs the gulp serve task which transpiles the code and puts it in the dist folder and then watches for more changes. If you change the source, it will transpile again. It also runs the superstatic server (you can run any server you want, but this is super simple) and launches the browser using browser-sync. When any files change, the browser will reload.

When you launch a browser to http://localhost:3000 SystemJS kicks in and looks for system.config.js for its settings. We tell SystemJS to use Babel to transpile and that the baseURL for the code is in ./assets. This is important so all import statements that were written assuming relative pathing in the src folder will still work. Finally, we tell SystemJS that import statements by default should assume they end with .js. This is accomplished by setting defaultJSExtensions to true. See below for an example.

System.config({
    baseURL: './assets',
    defaultJSExtensions: true
});

We can now import the main starting modules main.js like this:

System.import('demo/main');

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.