Update: I am working in recovering the site. I moved servers and some data was corrupted. The site will be down until it’s fixed.
Since early 2015 I have been blogging about Aurelia. It’s crazy to think Aurelia is already almost two years old.
In that time my blog has become known as the Aurelia blog. While this isn’t a bad thing, I love blogging and I want to feel comfortable to blog about non-Aurelia related things, non-code related stuff.
In Aurelia if you have a parent/base class and one or more children that inherit from this class AND the parent class has some injectables via Aurelia’s dependency injection container, you have most likely encountered an issue with needing to import and pass the dependencies back to the parent.
You might have done something like this:
import {inject} from 'aurelia-framework'; import {Router} from 'aurelia-router'; @inject(Router) export class Parent { constructor(router) { this.router = router; } } import {Parent} from './parent'; import {Router} from 'aurelia-router'; @inject(Router) export class Child extends Parent { constructor(router) { super(router); } } Gross.
If you’re using the Aurelia Webpack Skeleton and you’re developing locally using the development server, then you have probably encountered an issue with pushState and index.html resolution.
You can see this problem happening on the official skeleton. But essentially you enable pushState in your main.js or main.ts file using config.options.pushState = true; and then you load up the app on port 9000 through http://localhost:9000
Navigating around, you’ll see that the app works. Hitting the /users route should change your URL to http://localhost:9000/users and things work. Now what happens if you refresh the page or trying hitting /users directly? You’ll get gibberish.
A unique scenario popped up recently during a project I am building with Aurelia. I needed to cleanly be able to insert SVG images from a folder in my app and display them inline. Duplicating the SVG’s and inlining them was an option, or creating a custom element seemed like a better choice.
What I ended up coming with is the rather simple, but elaborate looking custom element which essentially replaces itself with the contents of an SVG.
Built With Aurelia is a nice little application that showcases what the Aurelia community are building with Aurelia and has been in the making for a while now. The idea stemmed from there being nowhere (until now) to see the great things that the Aurelia community have built.
Initially it was going to be solely just applications, but the site also includes plugins and themes. So if you’ve built something with Aurelia as well as something for use in Aurelia, feel free to submit it to the site.
So you’re using the CLI to build your next Aurelia application and you want to use the Fetch client? You might have noticed by default it does not come configured with the Fetch client. Fortunately, adding it in is a piece of cake.
Firstly, we want to install the Fetch Client as well as a Fetch polyfill:
npm install aurelia-fetch-client whatwg-fetch --save Now open up aurelia_project/aurelia.json
At the bottom in the bundles section, more specifically vendor-bundle.js look for the prepend section and add in the polyfill as this will be global and we want to include it before anything else. You might notice I put it above the RequireJS line.
As much as I love Npm, it can be quite buggy at times, especially on Windows.
One such error I encountered recently was trying to install the latest version of the Aurelia CLI by typing npm install -g aurelia-cli in most cases this just works and updates the existing version. However, a couple of times now, I kept getting some error about “ENOENT: no such file or directory, rename” and then something about a node_modules/.staging folder.
It has finally happened. After a long beta and relatively short release candidate period, Aurelia has hit a version 1.0 stable release which you can read more about here from the horse’s mouth. This means you can now safely use Aurelia to build your applications with confidence that it will be stable.
In all honesty, Aurelia as a core framework (not so much the tooling) has been stable since mid 2015 for me. Over the last year and a bit I have seen this framework grow from a small idea to an impressive and easy to use framework.
If you are developing an Aurelia application, just so happen to be using Webpack and need to support Internet Explorer 10, then you will probably want the MutationObserver polyfill.
The polyfill is installed via the Github repository, so you need to make sure that you only install a release version which has the individual polyfill scripts for different Web Component features. At the time of publishing this was version 0.7.22.
I have been having a bit of fun using the Aurelia CLI. One of the downsides is if you want to use Autoprefixer and PostCSS with something like Stylus, Less or Sass, you can’t choose a preprocessor and use Autoprefixer.
This is easy enough to add in manually and gets you familiar with how the CLI handles task (which use Gulp).
Install development dependencies Go into your project directory and run the following in your terminal of choice.