Skip to content
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 styles should be configured? #7

Open
hyzhak opened this issue Dec 20, 2017 · 1 comment
Open

how styles should be configured? #7

hyzhak opened this issue Dec 20, 2017 · 1 comment

Comments

@hyzhak
Copy link

hyzhak commented Dec 20, 2017

How webpack should be configured In a lib project which has not only js, but also style files (sass, less, css). When they should be deployed separately (build/main.min.js and build/main.min.css)?

And at the same time, js should not be hard bound to css. Because it is very easy to import css inside of js, but it won't work when you would like to give user possibility to choose whether they want your css or not.

There are few options (which don't work)

import css inside of js

// in main.js
import './style.sass';

but when a user would use this lib she would be forced to use styles.

refer css as an entry:

entry: {
  main: 'path/to/the/main.js',
  style: 'path/to/the/style.sass',
}

will create style.js which is not what could be expected.

use extract-text-webpack-plugin

https://github.com/webpack-contrib/extract-text-webpack-plugin
It still creates style.js but with desired style.css

@pardoman
Copy link

Would be great adding examples for this, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants