Marko

Marko + Rollup

The @marko/rollup transform can be used in conjunction with rollup to automatically compile Marko templates that are required by other modules. An official Rollup plugin will be coming soon.

The rollup sample app demonstrates how to use Marko with Rollup. Run npx @marko/create --template rollup to use this sample as a starting point for a new app.

Manual Installation

npm install rollup rollup-plugin-commonjs rollup-plugin-node-resolve @marko/rollup --save-dev

Configuration

The following is the minimal recommend configuration to use Rollup with Marko:

rollup.config.js
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import marko from "@marko/rollup";
 
export default {
  ...,
  plugins: [
    marko(),
    nodeResolve({
      browser: true,
      extensions: [".js", ".marko"]
    }),
    // NOTE: Marko 4 compiles to commonjs, this plugin is also required.
    commonjs({
      extensions: [".js", ".marko"]
    }),
    // If using `style` blocks with Marko you must use an appropriate plugin.
    postcss({
      external: true
    })
  ]
};

Usage

# Development: 
rollup -c rollup.config.js
 
# Production: 
NODE_ENV=production rollup -c rollup.config.js
EDIT

Contributors

Helpful? You can thank these awesome people! You can also edit this doc if you see any issues or want to improve it.