svelte-material-ui icon indicating copy to clipboard operation
svelte-material-ui copied to clipboard

Import everything

Open Bradley-H opened this issue 3 years ago • 2 comments

I'm not sure if this option is avilable already, I looked on the docs and didn't see anything on that. But anyhow, I'm curious if we could just import everything from SMUI instead of importing things individually. I don't want to stop production every 10 minutes to import a new component.

Bradley-H avatar Mar 12 '22 08:03 Bradley-H

You can already ; I use this in my own package.json :

{
  [...]
  "devDependencies": {
    [...]
    "svelte-material-ui": "6.0.0-beta.15"
  }
  [...]
}

If you are using pnpm, you might want to hoist packages, as it won't find them otherwise (add the snippet below to your .npmrc file if you are using pnpm) :

public-hoist-pattern[]=@material/*
public-hoist-pattern[]=@smui/*
public-hoist-pattern[]=@smui-extra/*

For reference, here's the package : https://github.com/hperrin/svelte-material-ui/tree/master/packages/svelte-material-ui

You can see that it imports everything in its package.json file, which will allow you to have them in your node_modules, and therefore available to your code.

V-ed avatar Apr 05 '22 15:04 V-ed

@V-ed that doesn't reduce the number of imports though. You still need lots of lines like this:

import List, { Item, Label as ListLabel } from "@smui/list";
import Tab, { Label as TabLabel } from "@smui/tab";

It would be nice if you could just do something like this:

import { Tab, TabLabel, List, ListItem, ListLabel } from "svelte-material-ui";

k-yle avatar Apr 05 '22 21:04 k-yle