npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurelia-mdl-plugin

v1.0.0

Published

Material Design Lite plugin for Aurelia.

Downloads

66

Readme

Material Design Lite plugin for Aurelia. CLI DEMO

NPM

Usage

With jspm:

jspm install material-design-lite
jspm install aurelia-mdl-plugin
  • Register the plugin:
import 'material-design-lite/material';

export function configure(aurelia) {
    ...
    aurelia.use.plugin('aurelia-mdl-plugin');
    ...
}
  • Load mdl CSS:
<template>
    <require from="material-design-lite/material.css"></require>
    ...
    <!-- give it a try -->
    <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">
        Button
    </button>
</template>

With Aurelia CLI:

  • Install:
npm i -S material-design-lite
npm i -S aurelia-mdl-plugin
  • Configure aurelia.json:

add mdl & plugin to one of your bundle's dependencies.

{
    "name": "material-design-lite",
    "path": "../node_modules/material-design-lite/dist",
    "main": "material",
    "resources": [
        "material.css"
    ]
},
{
    "name": "aurelia-mdl-plugin",
    "path": "../node_modules/aurelia-mdl-plugin/dist/amd",
    "main": "index"
}
  • Register the plugin:
import 'material-design-lite';
export function configure(aurelia) {
    ...
    aurelia.use.plugin('aurelia-mdl-plugin');
    ...
}
  • require css file the same way.
  • if you want to use another color theme:

change the resources key:

"resources": [
    "material.deep_orange-blue.min.css"
]

import the css:

<require from="material-design-lite/material.deep_orange-blue.min.css"></require>

Configure the plugin

  • manual upgrade:

the plugin looks for specific mdl components and adds a custom attribute for each one automatically. If for some reason you don't want to auto upgrade you can change that when registering the plugin:

aurelia.use
    .plugin('aurelia-mdl-plugin', m => m.autoUpgrade(false));

this way you need to add 'mdl-target' custom attribute manually to every component that needs upgrading.

  • upgrading other components:

if you want to upgrade other components like custom mdl components you can register them like this:

aurelia.use
    .plugin('aurelia-mdl-plugin', m => m.addClasses('mdl-custom-one', 'two'));
  • example: using mdl-selectfield with aurelia cli:

aurelia.json:

{
    "name": "material-design-lite",
    "path": "../node_modules/material-design-lite/dist",
    "main": "material",
    "resources": [
        "material.css"
    ]
},
{
    "name": "mdl-selectfield",
    "path": "../node_modules/mdl-selectfield/dist",
    "main": "mdl-selectfield",
    "resources": [
        "mdl-selectfield.css"
    ]
},
{
    "name": "aurelia-mdl-plugin",
    "path": "../node_modules/aurelia-mdl-plugin/dist/amd",
    "main": "index"
}

config:

import 'material-design-lite';
import 'mdl-selectfield';
export function configure(aurelia) {
    ...
    aurelia.use.
        plugin('aurelia-mdl-plugin', mdl => {
            mdl.addClasses('mdl-js-selectfield');
        });
    ...
}

require css in html:

<require from="material-design-lite/material.css"></require>
<require from="mdl-selectfield/mdl-selectfield.css"></require>

<div class="mdl-selectfield mdl-js-selectfield">
    <select id="gender" class="mdl-selectfield__select">
        <option value=""></option>
        <option value="option1">option 1</option>
        <option value="option2">option 2</option>
    </select>
    <label class="mdl-selectfield__label" for="gender">User gender</label>
    <span class="mdl-selectfield__error">Select a value</span>
</div>