astroturf icon indicating copy to clipboard operation
astroturf copied to clipboard

Add Rollup support

Open vladshcherbin opened this issue 5 years ago • 1 comments

It would be great to see rollup plugin/loader or example in the docs if it's already possible.

vladshcherbin avatar Mar 10 '19 22:03 vladshcherbin

To all watchers and upvoters - here is an example REPL.

Basically, needed rollup plugin configuration is:

plugins: [
  babel({
    babelHelpers: 'bundled',
    plugins: [
      'astroturf/plugin'
    ]
  }),
  postcss({
    extract: 'app.css',
    modules: true,
    plugins: [
      postcssNested
    ]
  })
]

Things to note:

  • I've used latest astroturf version available (v1.0.0-beta.11), beta version api probably differs from current stable one
  • Temporary css files from components are saved to disk, same as in Parcel plugin (https://github.com/4Catalyzer/astroturf/issues/610). They can be removed using other rollup plugin, for example rollup-plugin-delete

I've tested only basic stuff which is enough for my needs and it's working. Try it in your projects as well 😉

vladshcherbin avatar Aug 17 '20 10:08 vladshcherbin