Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mdc-pug

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdc-pug

Material Components Web implemented in Pug

  • 3.0.0-beta.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

MDC Pug

Material Components Web implemented in Pug.

Setup

Install the library:

npm i mdc-pug

If you plan on using the Sass files, you'll also need to install sass:

npm i -D sass

NOTE: MDC Pug (as well as MDC Web) uses the new Sass Module System. Unfortunately at this time the node-sass implementation does not support it. Please use the sass library.

Usage

Pug

You can include the whole library in your layout file:

layout.pug

include path-to-node_modules/mdc-pug/index

doctype html
html
  head
    link(rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500')
    link(rel='stylesheet' href='https://fonts.googleapis.com/icon?family=Material+Icons')
    link(rel='stylesheet' href='path-to-node-modules/mdc-pug/dist/mdc.css')

body.mdc-typography
  block body

  script(src='path-to-node-modules/mdc-pug/dist/mdc.js')
  script.
    mdc.autoInit();

All of the components will be available as mixins in other pug files that extend the layout:

hello.pug

extends layout

block body
    +mdc-typography('Hello World')
    +mdc-button('Click Me')

Alternatively you can include only the components you need:

include path-to-node_modules/mdc-pug/mixins/button
include path-to-node_modules/mdc-pug/mixins/typography

doctype html
html
    head
        link(rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500')
        link(rel='stylesheet' href='https://fonts.googleapis.com/icon?family=Material+Icons')
        link(rel='stylesheet' href='path-to-node-modules/mdc-pug/dist/mdc.css')

    body.mdc-typography
        +mdc-typography('Hello World')
        +mdc-button('Click Me')

    script(src='path-to-node-modules/mdc-pug/dist/mdc.js')
    script.
        mdc.autoInit();

Sass

You can use all the styles:

@use 'path-to-node_modules/mdc-pug';

or only the compon you need:

@use 'path-to-node_modules/mdc-pug/lib/styles/button';
@use 'path-to-node_modules/mdc-pug/lib/styles/typography';

Keywords

FAQs

Package last updated on 28 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc