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

Non-trivial TS/Vue/SCSS cookbook example using @latest #343

Open
davestewart opened this issue Apr 28, 2020 · 7 comments
Open

Non-trivial TS/Vue/SCSS cookbook example using @latest #343

davestewart opened this issue Apr 28, 2020 · 7 comments
Milestone

Comments

@davestewart
Copy link

davestewart commented Apr 28, 2020

What problem does this feature solve?

Allows people to easily build a non-trivial Vue plugin, e.g. an alert component.

The existing cookbook examples work - but use out of date dependencies and don't work when upgraded, and there simply appear to be no complete examples on the web.

What does the proposed API look like?

Includes:

  • TypeScript
  • nested SCSS with imported variables
  • components in subfolders
  • exported TS helper functions, such as alert()
  • helper and component exported from index.ts
  • a working tsconfig.json
  • exported *.d.ts files

Additionally:

  • imported scss files trigger reload when using rollup -w
  • import of .vue files without having to add .vue
  • optional sourcemaps
@davestewart davestewart changed the title SCSS cookbook example Non-trivial TS/Vue/SCSS cookbook example Apr 28, 2020
@davestewart davestewart changed the title Non-trivial TS/Vue/SCSS cookbook example Non-trivial TS/Vue/SCSS cookbook example using @latest Apr 28, 2020
@mesqueeb
Copy link

mesqueeb commented May 2, 2020

+1 !!

@przemkow
Copy link
Contributor

przemkow commented May 24, 2020

Hi guys,
I created for you this repo with an example of boilerplate I'm using for libs/components development:
https://github.com/przemkow/rollup-vue-advanced-example

The biggest different between example from docs and this implementation is replacing @rollup/plugin-typescript (aka rollup-plugin-typescript) with rollup-plugin-typescript2 which I fund in Vue 3 rollup configuration.

I think it covers everything except:

  • import of .vue files without having to add .vue
  • optional sourcemaps
  • output as IIFE (I always use those components in vue-cli / Nuxt app so I never tested that)

Could you look at this repo and let me know if it covers your use cases? If everything works fine maybe I will open PR with docs update basing on that implementation.

@davestewart
Copy link
Author

Hey @przemkow - thanks!

I'll take a look at some point in the next day or so.

I was having issues with duplicated SCSS so I will need to check my current bundling output to see if that is still a problem, and if so, whether it's me or the plugin.

Good work!

@DrMabuse23
Copy link

this works with vue-property-decorator ?

@przemkow
Copy link
Contributor

@DrMabuse23 I think so, after installing that dependency and enabling experimentalDecorators in tsconfig.json everything should work fine.

@przemkow
Copy link
Contributor

przemkow commented Feb 2, 2021

@davestewart I don't know if this will be still useful for you but I will leave it here - maybe it will solve someone's else issue :)

We resolved a problem with duplicated CSS styles by transforming generated CSS with postcss and cssnano before they are saved.
https://github.com/przemkow/rollup-vue-advanced-example/blob/master/rollup.config.js#L55

@davestewart
Copy link
Author

He's back!

Haven't looked at this project for a while now (can't remember what state it's in, even) but really appreciate you returning to drop your learnings here!

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

5 participants