GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - framework7io/rollup-plugin-framework7: Rollup & Vite plugin to load Framework7 single file components

BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
lib
lib
 
 
test
test
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierrc
.prettierrc
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Rollup Framework7 Component Loader

Rollup & Vite plugin to load Framework7 single file components

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 {
  plugins: [framework7({ emitCss: false })],
};

JSX in .f7.jsx components is compiled to Framework7's $jsx automatically, no esbuild or oxc JSX config is required (works with both Vite 8+ and older versions).

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

framework7.io

Topics

rollupvite

Resources

Readme
MIT license
Activity
Custom properties

Stars

8 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.