Aurelia-CLI
First of all, webpack is highly recommended. The amount of fiddling with the new CLI version 0.33.1
is just annoying.
Not convinced? Keep reading and compare to webpack installation procedure.
Scaffolding the app
Make sure you have at least version 0.32.0
of Aurelia-CLI installed.
Note: 0.33.1
requires some additional configuration. Make sure you follow the instructions!
Choose Aurelia options as you see fit. In the last step, choose to install all dependencies.
Getting the plugin
In your project install the following via CLI (execution order matters!):
The materialize-amd
is an AMD compatible build of Materialize-CSS. Installing it with au new
also copies CSS and font files to the styles
folder.
Note: Due to a change in Materialize's loading order (probably this commit), version v0.100.2 won't work with Aurelia CLI RequireJS. Therefore, the maximum (and in fact the only) AMD build is v0.100.1
If you need an AMD build of an earlier version create and issue in the repository
Configure your app
For Material Design icons include this in your
index.html
head section:Add this to
main.js
in yoursrc
folder:Note: The above shows how to use all available controls at once. If you choose to pick which you'd like to use, you can
use
single components like this:At the end of this page is a full list of currently available options. Important:
preventWavesAttach
is only needed with CLI to prevent dimmed buttons. See this issue for details.Add this to your
index.html
Note: The CLI cannot bundle fonts like webpack, plus
materialize.css
file references the fonts by relative paths (eg "../fonts/roboto/Roboto.ttf").If you
require
materialize.css
from HTML the relative path is interpreted to be relative to the path specified inaurelia.json
. While in reality, fonts still reside innode_modules
, requirejs looks for fonts inmaterialize-amd/fonts/roboto
(from evaluation ofmaterialize-amd/css/../fonts/roboto
).You can still use the following in
app.html
but in this case you will have to manually copy fonts to
materialize-amd
folder in the root of your project.When using version
0.33.1
of the CLI add "node_modules/jquery/dist/jquery.js" to theprepend
section of thevendor-bundle.js
configuration in theaurelia.json
file. Without it your project won't run, complaining about missing$
declaration and weirdly loading modules fromnode_modules
directly. Removejquery
fromdependencies
section.When using version
0.33.1
of the CLI add "node_modules/materialize-amd/dist/js/materialize.amd.js" to the end ofprepend
section of thevendor-bundle.js
configuration in theaurelia.json
file - afterjquery
andrequire
. Also removematerialize-amd
configuration fromdependencies
section.Note: This is necessary because dependencies loading order is broken again in CLI (duh!). If
materialize-amd
is left in there it will add functions to the prependedjquery
but the bridge will try to usejquery
from dependencies.
You are done!
It is now possible to drop some custom-elements into your DOM. See the other pages on this website for detailed information on how to do this.
Now you might want to do our app developers tutorial, based on Aurelia Skeleton navigation.
As described above, here is a full list of available options:
Last updated