Socket
Socket
Sign inDemoInstall

mdc-pug

Package Overview
Dependencies
2
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mdc-pug

Material Components Web implemented in Pug


Version published
Maintainers
1
Install size
38.0 MB
Created

Readme

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

Last updated on 28 Oct 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc