Search This Blog

Setup Svelte Material UI

  1. Install svelte-preprocess
    npm install -D svelte-preprocess
  2. Install any Svelte Material UI comonent:
    npm install --save-dev @smui/button
    Note: you need to install at least one component otherwise you cannot compile the theme css.
  3. Install smui-theme and create a template at src/theme
    npm install -D smui-theme
    npx smui-theme template src/theme
  4. Add following script to scripts section of package.json
    "prepare": "smui-theme compile public/build/smui.css -i src/theme"
  5. Compile the css from smui-theme template:
    npm run prepare
    It should create public/build/smui.css
  6. Add the compiled css to public/index.html file:
    <link rel='stylesheet' href='/build/smui.css'>
  7. Add Material Fonts to public/index.html
    <link
    rel="stylesheet"
    href="https://fonts.googleapis.com/icon?family=Material+Icons"
    />
    <!-- Roboto -->
    <link
    rel="stylesheet"
    href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700"
    />
    <!-- Roboto Mono -->
    <link
    rel="stylesheet"
    href="https://fonts.googleapis.com/css?family=Roboto+Mono"
    />

No comments:

Post a Comment