material-components-vue icon indicating copy to clipboard operation
material-components-vue copied to clipboard

Lack of documentation for getting started with vue-cli

Open johnhorsema opened this issue 5 years ago • 3 comments

Describe the bug Lacks proper documentation for getting started with this library. I had to manually install sass-loader and still run into compilation issues.

To Reproduce Running webpack development server after installing this library and importing Buttons.vue as component and theme styles in the

Expected behavior A clear and concise Getting Started section.

Solution Add a Getting Started With Vue-Cli 3.X section to the documentation site.

  1. Install sass-loader
  2. Set vue.config.js as follows
const path = require("path")

module.exports = {
  chainWebpack: config => {
    config.module
      .rule("scss")
      .oneOf("vue-modules")
      .use("sass-loader")
      .tap(args => {
        args.includePaths = ["./node_modules"]
        return args
      })
  },
  css: {
    loaderOptions: {
      sass: {
        includePaths: [path.resolve(__dirname, "node_modules")],
        data: `
          @import "material-components-vue/theme/dist/styles";
        `
      },
    },
  },
}

johnhorsema avatar Apr 26 '19 17:04 johnhorsema

@johnhorsema Personally, I use the following

const path = require('path')
const nodeModules = path.resolve('node_modules/')

module.exports = {
  css: {
    loaderOptions: {
      sass: {
        includePaths: [nodeModules]
      }
    }
  }
}

Reference: https://github.com/material-components/material-components-web/blob/master/docs/getting-started.md

I'm also considering creating a vue-cli template.

Pull request is welcomed.

tychenjiajun avatar Apr 27 '19 01:04 tychenjiajun

Another example is in https://github.com/Kava-Labs/switch/blob/master/vue.config.js

tychenjiajun avatar Apr 27 '19 05:04 tychenjiajun

@matsp help wanted in all issues related to docs.

tychenjiajun avatar Apr 28 '19 02:04 tychenjiajun