Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including angular-material-prefix-updater with all npm packages installed. Try it out:

var angularMaterialPrefixUpdater = require("angular-material-prefix-updater")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

angular-material-prefix-updater v0.0.6

Switches the `Md` prefix to `Mat` in Angular Material apps

Angular Material "md" -> "mat" prefix updater.


npm i -g angular-material-prefix-updater

Note: Running this tool with Angular Material versions higher than beta.11 will not work. The prefix updater tool requires type information from the outdated Md classes.

The upgrade to the latest version of Angular Material should happen after running the tool.


# Show the help for the tool
mat-switcher --help

# Run the tool to update prefixes
mat-switcher -p path/to/project/tsconfig.json

# Run the tool to update prefixes with additional style
# files not referenced by an Angular component, where --extra-css
# accepts a glob pointing to the style files
mat-switcher -p path/to/project/tsconfig.json --extra-css 'custom/**/*.css' 

After running the tool

After running the tool, add a provider to the root of your application:

import {MATERIAL_COMPATIBILITY_MODE} from '@angular/material';

  providers: [
    {provide: MATERIAL_COMPATIBILITY_MODE, useValue: true},
    // ...
export class MyModule { }

This will enforce that only the "mat" prefix is used for all selectors.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free