Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

biguphpc/rollup-plugin-framework7

Open more actions menu
 
 

Repository files navigation

Rollup Framework7 Component Loader (forked for bug fix)

Why this fork:

To workaround the issue described here (framework7io/framework7#4244)

What is Framework7 Component Loader?

rollup-plugin-framework7 is a plugin for Rollup and Vite that allows you to author Framework7 Router components in a format called Single-File Components:

<!-- my-page.f7.html (or my-page.f7) -->
<template>
  <div class="page">${msg}</div>
</template>

<script>
  export default () => {
    const msg = 'Hello world';

    return $render;
  };
</script>

Usage with Rollup

Install the plugin itself:

npm i rollup-plugin-framework7 --save-dev

If we use JSX component, then we also need to install Babel plugins:

npm i @rollup/plugin-babel @babel/preset-react @babel/preset-env --save-dev

Configure rollup:

const { rollup } = require('rollup');
const { babel } = require('@rollup/plugin-babel');
const framework7 = require('../lib/index');
rollup({
  input: './path/to/app.js',
  plugins: [
    // enable Framework7 plugin
    // it will will process .f7.html and .f7.js(x) files
    framework7({ emitCss: true }),

    // css plugin for bundling content of component styles (`<style>`)
    css({ output: 'app-bundle.css' }),

    // babel plugin if you use JSX components
    babel({
      presets: [
        '@babel/preset-react',
        [
          '@babel/preset-env',
          {
            modules: false,
          },
        ],
      ],
    }),
  ],
});

Usage with Vite

Install the plugin:

npm i rollup-plugin-framework7 --save-dev

In Vite config (vite.config.js):

import framework7 from 'rollup-plugin-framework7';

export default {
  esbuild: {
    jsxFactory: '$jsx',
  },
  plugins: [framework7({ emitCss: false })],
};

JSX

Framework7 v6 single file components also support JSX:

<!-- my-page.f7.html (or my-page.f7) -->
<script>
  export default () => {
    const msg = 'Hello world';

    return () => <div class="page">{msg}</div>;
  };
</script>
// my-page.f7.js

export default () => {
  const msg = 'Hello world';

  return () => <div class="page">{msg}</div>;
};

About

Rollup & Vite plugin to load Framework7 single file components (forked for fix test)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.5%
  • HTML 2.2%
  • CSS 0.3%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.