• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The home for Aurelia's concatenated script-tag-ready build.

aurelia-script

Join the chat at https://gitter.im/aurelia/discuss

This repo is the home for Aurelia's concatenated script-tag-ready build.

To keep up to date on Aurelia, please visit and subscribe to the official blog and our email list. We also invite you to follow us on twitter. If you have questions, please join our community on Gitter or use stack overflow. Documentation can be found in our developer hub.

Getting started with Aurelia Script

Simple examples

In the good old day, you chuck in a script tag into your html and start writing app. Aurelia Script is a way to help you return to that, with Aurelia. Simply add:

  <script src='https://unpkg.com/[email protected]'></script>

into your main html and you are ready to go, like the following:

	<script>
    au
      .start({
        debug: true,
        // root: 'app.js', // can be ommitted, default is app.js
        // host: document.body // can be ommitted, default is document.body
      })
      .catch(ex => {
        document.body.textContent = `Bootstrap error: ${ex}`;
      })
	</script>

If you want to enhance a section of your page, which is a typical requirement in CMS environment:

	<script>
    au
      .enhance({
        host: document.querySelector('.datepicker')
        // root can be a string, an object or a constructor function
        // aurelia will automatically instantiate if a function is given
        root: class DatePickerViewModel {
          format = 'dd/MM/yyyy'
        },
      });
  </script>

If you want to reuse the same Aurelia instance for multiple enhancements, you can do:

  var aurelia = new au.Aurelia();
  aurelia.start().then(() => {
    // here you are ready to enhance or start a new app
  });

Using aurelia-script with ES5:

For some projects that need to run in ES5, there are 2 dists that can be used: dist/aurelia_no_loader.es5.umd.js and dist/aurelia_router_no_loader.es5.umd.js (or equivalent minified versions). This is great when you just want to use Aurelia for its templating/binding capabilities (progressive enhancement, sub section of a bigger app for example). As their name suggest, there's no loader bundled with them, but you can easily add a loader to fit your need, in case you need to dynamically load a module. Both Requirejs and SystemJS are compatible with ES5 environments to dynamically load modules at runtime. Just make sure you configure Aurelia modules aliases correctly if those modules happen to have a dependencies on one of Aurelia modules.

What is with au:

au is a global namespace for all exports from Aurelia modules, instead of importing from aurelia-framework module. This is because aurelia-script is bundled in UMD module format, to enable simple, old school style usage. For example:

The equivalent of

import { CompositionEngine, ViewCompiler } from 'aurelia-framework';

In Aurelia Script would be:

const { CompositionEngine, ViewCompiler } = au;

With ESM:

There is another distribution bundle that is in ES module format, which you can think of it as a barrel export version of all Aurelia modules in ESM. For example:

The equivalent of

import { BindingEngine, CompositionEngine, ViewCompiler } from 'aurelia-framework';

In Aurelia Script esm distribution would be:

import {
  BindingEngine,
  CompositionEngine,
  ViewCompiler
} from 'https://unpkg.com/[email protected]/dist/aurelia.esm.min.js';

Online Playground with Single file script

Development

Build

  1. Install the dependencies
npm install
  1. Run either the build / bundle script
# Build only core
npm run build
# Or full build, with router
npm run bundle

Run the example project

  1. Go to example folder inside this project
  2. Start a http server
  3. Navigate to index.html in browser

How it works?

  1. dist folder contains built result of all aurelia bundles, together with their minified versions, with different scopes:
    • bundles with names ending in .esm.js are in ESM (ECMAScript Module) format. bundles with names ending in .umd.js are in UMD (Universal Module Definition) format.
    • aurelia.esm.js, aurelia.umd.js are bundles without router feature. Typically used when you want to minimized to script included in your page.
    • aurelia_router.esm.js, aurelia_router.umd.js are bundles of with router feature.
  2. example folder contains an example application to get started. Step to run it included in the section above
  3. scripts folder contains all built result of all aurelia core modules, in AMD module format for environment like gistrun (https://gist.run)
  4. build folder contains entry/ setup script, code for building / emiting code to dist and example folders.
    • index.js and index.full.js are custom entries to give rollup instruction how to bundle all core modules. index.js will result in a bundle without router related features. index.full.js will result in a bundle with all features.
    • rollup.config.js is rollup config for running npm run bundle and npm run build scripts

Notes:

aurelia-script uses new ECMAScript feature: dynamic import via import() API. If your target browser does not support such API, aurelia-script won't be able to run. Browser support matrix is at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Browser_compatibility (check for Dynamic import)

More Repositories

1

framework

The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
TypeScript
11,748
star
2

aurelia

Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.
TypeScript
1,388
star
3

skeleton-navigation

Starter kits for building a standard navigation-style app with Aurelia.
JavaScript
733
star
4

cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
JavaScript
407
star
5

ux

A user experience framework with higher-level capabilities, designed to bring simplicity and elegance to building cross-device, rich experiences.
TypeScript
367
star
6

dependency-injection

A lightweight, extensible dependency injection container for JavaScript.
TypeScript
157
star
7

validation

A validation plugin for Aurelia.
TypeScript
132
star
8

router

A powerful client-side router.
TypeScript
121
star
9

templating

An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.
TypeScript
116
star
10

vscode-extension

An extension for the VS Code editor that provides Intellisense capabilities to your Aurelia project.
TypeScript
112
star
11

binding

A modern databinding library for JavaScript and HTML.
JavaScript
111
star
12

app-contacts

A sample app that lets you browse and edit contacts.
JavaScript
110
star
13

dialog

A dialog plugin for Aurelia.
TypeScript
107
star
14

documentation

The documentation for Aurelia.
105
star
15

store

Aurelia single state store based on RxJS
TypeScript
103
star
16

app-ux-showcase

An application that showcases the various features of Aurelia UX.
HTML
98
star
17

i18n

A plugin that provides i18n support.
TypeScript
93
star
18

webpack-plugin

A plugin for webpack that enables bundling Aurelia applications.
TypeScript
90
star
19

ui-virtualization

A plugin that provides a virtualized repeater and other virtualization services.
TypeScript
90
star
20

fetch-client

An HTTP Client based on the Fetch standard.
TypeScript
76
star
21

bootstrapper

Sets up the default configuration for the aurelia framework and gets you up and running quick and easy.
JavaScript
75
star
22

http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
JavaScript
62
star
23

templating-resources

A standard set of behaviors, converters and other resources for use with the Aurelia templating library.
TypeScript
59
star
24

event-aggregator

A lightweight pub/sub messaging system for app-wide or per-object loosely coupled events.
JavaScript
57
star
25

template-lint

Sanity check of Aurelia-flavor template HTML
TypeScript
56
star
26

skeleton-plugin

A starter kit for building an Aurelia plugin.
JavaScript
55
star
27

animator-css

An implementation of the abstract Animator interface from templating which enables css-based animations.
JavaScript
45
star
28

web-components

A plugin capable of transforming Aurelia components into standards-compliant Web Components.
TypeScript
41
star
29

registry

A registry of Aurelia plugins, cli plugins, gists and other awesome goodies you can use with Aurelia and its tools.
40
star
30

testing

Simplifies the testing of UI components by providing an elegant, fluent interface for arranging test setups along with a number of runtime debug/test helpers.
TypeScript
40
star
31

new

The Aurelia 2 scaffolding repo used by our tools to setup new projects.
JavaScript
38
star
32

tools

Tools and utility functions used to build and develop Aurelia's libraries.
JavaScript
37
star
33

bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
TypeScript
37
star
34

task-queue

A simple task queue for the browser that enables the queuing of both standard tasks and micro tasks.
JavaScript
36
star
35

inspector

The Aurelia 1 Chrome plugin which provides Aurelia-specific information about elements selected in the inspector.
HTML
35
star
36

dotnet

Official .NET tooling for Aurelia.
C#
33
star
37

templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
TypeScript
32
star
38

metadata

Utilities for reading and writing the metadata of JavaScript functions.
TypeScript
28
star
39

route-recognizer

A lightweight JavaScript library that matches paths against registered routes. It includes support for dynamic and star segments and nested handlers.
JavaScript
27
star
40

templating-router

An implementation of the RouteLoader interface for use with the router module. Also contains a custom element that allows the templating engine to display the current route.
TypeScript
26
star
41

loader-webpack

An implementation of Aurelia's loader interface to enable webpack.
TypeScript
26
star
42

loader

An abstract module which specifies an interface for loading modules and view templates.
JavaScript
26
star
43

polyfills

The minimal set of polyfills needed to run Aurelia.
JavaScript
26
star
44

hot-module-reload

Core functionality for Aurelia's hot-module-reolad (HMR) capabilities, which is shared by all loaders and tools.
TypeScript
25
star
45

logging

A minimal but effective logging mechanism with support for log levels and pluggable log appenders.
JavaScript
24
star
46

history-browser

An implementation of the history interface based on standard browser hash change and push state mechanisms.
TypeScript
23
star
47

skeleton-server-render

A skeleton for setting up Aurelia for server-rendering.
22
star
48

validatejs

Enables expressive validation using decorators and/or a fluent API.
JavaScript
22
star
49

pal-nodejs

The NodeJS-based implementation of Aurelia's platform abstraction layer.
TypeScript
22
star
50

animator-velocity

An implementation of the abstract Animator interface from templating which enables velocity-based animations.
JavaScript
22
star
51

path

Utilities for path manipulation.
TypeScript
21
star
52

history

An abstract module which specifies the interface for history implementations used by a router.
JavaScript
21
star
53

pal

Aurelia's Platform Abstraction Layer
JavaScript
19
star
54

loader-default

A default implementation of the loader interface compatible with system.js and require-based loaders.
JavaScript
19
star
55

pal-browser

The browser-based implementation of Aurelia's platform abstraction layer.
JavaScript
18
star
56

benchmarks

Performance benchmarks for Aurelia.
JavaScript
17
star
57

logging-console

A console log appender for the Aurelia logging library.
JavaScript
17
star
58

aurelia2-examples

A collection of Aurelia 2 example applications showcasing how to build Aurelia 2 applications and other tasks.
TypeScript
17
star
59

ssr-engine

The server-side rendering engine for Aurelia.
JavaScript
16
star
60

site-generator

The static site generator for http://aurelia.io.
HTML
15
star
61

html-import-template-loader

Use HTMLImport technology to load views.
JavaScript
12
star
62

html-template-element

A polyfill for the HTMLTemplate element extracted and decoupled from Polymer.
JavaScript
12
star
63

typings

A place to store TypeScript Definition Files which Aurelia developers may need, but which aren't available elsewhere.
11
star
64

loader-nodejs

An implementation of the abstract Loader interface for NodeJS
TypeScript
10
star
65

v1

The Aurelia 1 scaffolding repo used by our tools to setup new projects.
JavaScript
9
star
66

pal-worker

The web-worker-based implementation of Aurelia's platform abstraction layer.
JavaScript
8
star
67

bootstrapper-webpack

A custom bootstrapper for using Webpack with Aurelia
JavaScript
8
star
68

protractor-plugin

An Aurelia protractor plugin.
JavaScript
6
star
69

http-client-mock

Provides a mock implementation of Aurelia's http-client for use in testing.
JavaScript
4
star
70

tools-ts

The shared set of tools that are used for TypeScript library builds.
4
star
71

ssr-bootstrapper-webpack

JavaScript
4
star
72

loader-esm

An ESNext spec-compliant loader plugin for Aurelia.
TypeScript
3
star
73

docker

Dockerfile
3
star
74

middleware-koa

Koa middleware for Aurelia SSR
JavaScript
2
star
75

circleci

CircleCI configurations and utilities used by Aurelia repositories
2
star
76

e2e-tests

A set of e2e tests used by Aurelia's CI
TypeScript
2
star
77

v1-documentation

Aurelia v1 documentation
1
star
78

aurelia.github.io

The web site for Aurelia.
HTML
1
star
79

routing-application

A simple application showcasing how easy it is to configure Aurelia 2 applications with routes.
JavaScript
1
star