Zodiase / meteor-mdl

Material Design Lite package for Meteor
https://atmospherejs.com/zodiase/mdl
Apache License 2.0
53 stars 5 forks source link

Material Design Lite for Meteor

Material Design Lite lets you add a Material Design look and feel to your websites. It doesn’t rely on any JavaScript frameworks and aims to optimize for cross-device use, gracefully degrade in older browsers, and offer an experience that is immediately accessible.

Visit MDL's website to learn how to get started with MDL.

Build Status

Features

Install

$ meteor add zodiase:mdl

How to Use

After installing, create an empty settings file zodiase-mdl.json under the root of your app. Without it most functions will be disabled.

Other than that, there is nothing special to do. Enjoy! :D

If you want to pick your own theme, like what the MDL team have here, here's how:

  1. First pick your theme colors from that page. You would have to pick both the primary color and the accent color.

  2. Note that on the lower part of that page, there's a link that basically tells you what colors you have picked.

    • The link is always composed by material.{primary}-{accent}.min.css. I picked deep_orange and blue for example, and that link looks like material.deep_orange-blue.min.css.
  3. Now create a zodiase-mdl.json file under the root of your app if you haven't already. This file stores the settings.

  4. In that setting file, compose a JSON document that looks similar to this:

    {
      "theme": {
        "primary": "deep_orange",
        "accent": "blue"
      }
    }
  5. This will tell the package to load the corresponding theme file.

If you want more than pre-built themes:

You can load up the SASS source code and define your own colors!

  1. First you'd need to tell the package not to load any theme file.

    {
      "theme": false
    }
  2. Define your own theme colors and load MDL's SASS code.

    // mdl-theme.scss
    $color-primary: "0,0,0";
    $color-accent: "255,255,255";
    @import '{zodiase:mdl}/theme';
  3. There you go!

  4. There's a full range of variables you can customize. Check out MDL's variables to learn more.

If you want to import SASS files from MDL's source code:

They are all under {zodiase:mdl-assets}/src so have fun!

Auto Upgrade

One big thing this package does for you is auto-upgrading everything.

This feature is enabled by default. You can disable it within the settings file:

{
  "patches": {
    "autoUpgrade": false
  }
}

Doing so would turn off the entire auto-upgrader to save memory. However, this also means that you can NOT use it later in runtime. When auto-upgrader is turned off, MDl.autoUpgrade === null.

Aside from false, autoUpgrade can take one of the three other values: ["fullUpgrade"|"mutationOnly"|"none"], with "fullUpgrade" being the default.

While at runtime and the auto-upgrader is not turned off in the settings, MDl.autoUpgrade is the instance of the auto-upgrader with the following interfaces:

Note that at this point in runtime it is impossible to turn off auto-upgrader any more. So false is not an acceptable value for .setUpgradeStyle().

Known Issues

Versioning

The version of this package matches MDL's version to make it easy to perceive what version of MDL it contains. In addition, it has a fourth version number indicating revisions not related to MDL.

License

(MDL source is owned by Google and licensed under an Apache-2 license.)

© Xingchen Hong, 2016. Licensed under an Apache-2 license.