ktr0731 / materialize-loader

A webpack loader for Materialize Css Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

materialize-loader

Package Quality Dependency Status Known Vulnerabilities

Materialize configuration and loading package for webpack, using materialize-css (Sass).

Based on bootstrap-webpack by Scott Bleck (@bline) and font-awesome-webpack by Gowrav Shekar (@gowravshekar).

Usage

To properly load materialize-css, you need to configure loaders in your webpack.config.js. Example:

module.exports = {
  module: {
    loaders: [
      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader:"url?limit=10000&mimetype=application/font-woff" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file" }
    ]
  }
};

Don't forget to install appropriated loaders

npm install --save-dev url-loader file-loader

Complete Materialize

To use the complete Materialize package including all styles with the default settings:

require("materialize-loader");

Custom configuration

You can configurate materialize-loader with two configuration files:

  • materialize.config.js
  • materialize.config.scss

Add both files next to each other in your project. Then:

require("materialize-loader!./path/to/materialize.config.js");

Or simple add it as entry point to your webpack.config.js:

module.exports = {
  entry: [
    "materialize-loader!./path/to/materialize.config.js",
    "your-existing-entry-point"
  ]
};

materialize.config.js

Example:

module.exports = {
  styles: {
    "materialize": true,
  }
};

materialize.config.scss

Imported after Materialize's default variables, but before anything else.

You may customize Materialize here.

Example:

$primary-color: color("blue-grey", "lighten-2");
$primary-color-light: lighten($primary-color, 15%);
$primary-color-dark: darken($primary-color, 15%);

About

A webpack loader for Materialize Css Library

License:MIT License


Languages

Language:JavaScript 88.2%Language:CSS 11.8%