-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Use #21
Comments
@prateekbh I think most people would be using this via webpack or rollup, which would mean importing CSS is okay - maybe for ease-of-use Could then just have |
Tree shaking may also be applicable to CSS in future, with plugin like dead-css-loader which ATM depends on changes to css-loader (#402) and style-loader (#166) that haven't been merged yet. |
are you saying that the Button component should also import '@material/button/dist/button.css' within itself? What if someone is working with |
@laggingreflex that'd be great, but we need the solution for till that time.. |
Hmm, yeah that's true. Maybe the build job for this repo could inline the CSS? (for now at least?) |
Had the exact same thing in my mind, do u happen to know any way to do it? |
Why not let the user take care of importing whatever CSS they need? If the naming is consistent (as it is now), it's dead simple for the user and he can use any build tool he wants. |
@Download ideal would be both options. Currently delegating CSS imports to the user is a little ugly: import Button from 'preact-material-components/Button';
import 'preact-material-components/Button/style.css';
import Card from 'preact-material-components/Card';
import 'preact-material-components/Card/style.css';
import Switch from 'preact-material-components/Switch';
import 'preact-material-components/Switch/style.css'; Also for ES imports: import { Button, Card, Switch } from 'preact-material-components';
// still need to import all these :(
import 'preact-material-components/Button/style.css';
import 'preact-material-components/Card/style.css';
import 'preact-material-components/Switch/style.css'; It'd be really neat if there was an option to import it either way though: import { Button, Card, Switch } from 'preact-material-components';
import 'preact-material-components/style';
// or
import Button from 'preact-material-components/Button';
import 'preact-material-components/Button.css'; |
@developit yes thats the plan to support both the ways. 1.) import the entire css |
A lot of components are now ready and working in the sample folder.
Until Uglify does not tree shake IIFE/classes(mishoo/UglifyJS#1261), we have a way to separately use the JS files like
import Button from 'preact-material-components/Button'
import Card from 'preact-material-components/Card' etc...
and for CSS i can think of something like
import 'preact-material-components/Button/Button.css'
but then there are css like typography, theme may be more..
and this pkg doesnt have any control regarding the typography, theme etc as these are mere classes without any DOM.
any Ideas about how to bundle CSS?
need an easy way to keep them separate else people will start falling back to complete bundle.
@developit
The text was updated successfully, but these errors were encountered: