Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

How to rollup Vue component with styles? #7

Closed
znck opened this issue May 29, 2016 · 4 comments
Closed

How to rollup Vue component with styles? #7

znck opened this issue May 29, 2016 · 4 comments

Comments

@znck
Copy link
Member

znck commented May 29, 2016

It can be done in one these ways:

  • Export compiled CSS as vendor.common.css
  • Export compiled SCSS as vendor.common.scss
  • Inject CSS in JS

I choose 2nd.

Any other suggestions?

@victorwpbastos
Copy link

Would be great as an option.

@zce
Copy link

zce commented Jun 28, 2016

+1

@thgh
Copy link

thgh commented Aug 19, 2016

Here is a proposal to change the behaviour for CSS based on an option:

vue({
  // Pass a filename to write all styles to
  css: 'bundle.scss',

  // Pass a function that will be called ongenerate with two arguments:
  // - all styles concatenated
  // - an array of style nodes
  css (styles, styleNodes) {
    writeFileSync(cssPath, styles)
  }

  // Default behaviour is to write all styles to options.dest of the bundle
  // where .js is replaced by .css
  css: null,
})

@znck znck assigned znck and unassigned znck Aug 20, 2016
@znck
Copy link
Member Author

znck commented Aug 20, 2016

@thgh Continue implementing this. This would work.

If a project uses mix of style langs than it would not work. But that is acceptable (for now).

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

No branches or pull requests

4 participants