Framework7
repository·master·Indexed 12 days ago
https://github.com/framework7io/framework7A comprehensive mobile HTML framework for building native-looking iOS and Android applications using HTML, CSS, and JavaScript. It provides a suite of mobile-optimized UI components and layouts with official integrations for React, Vue.js, and Svelte.
What's inside Framework7
- Framework7 is a full-featured mobile HTML framework designed for building high-quality iOS and Android applications. It provides a suite of components and tools to create mobile-optimized user interfaces using web technologies.
Overview of Framework7 Vue
masterFramework7 Vue is a combination of the Vue.js framework and the Framework7 mobile UI framework. It is designed to allow developers to build mobile applications more quickly by leveraging the power and simplicity of Vue.js alongside the flexible mobile UI components provided by Framework7.Use Framework7 with Svelte
masterFramework7 Svelte integrates the Svelte framework with the Framework7 mobile UI components. This combination allows you to build mobile applications using Svelte's reactivity and component model while leveraging Framework7's mobile-optimized UI, layouts, and navigation features.Getting started with Framework7
masterTo begin building with Framework7, follow these core steps:
- Read the Introduction: Understand the core concepts and capabilities.
- Follow the Installation Guide: Set up the framework in your development environment.
- Define your App Layout: Plan the structure of your mobile application.
- Initialize your App: Use the Framework7 API to boot your application instance.
Detailed guides are available at the official documentation site.
Getting started with Framework7 Vue
masterTo begin building with Framework7 Vue, you should follow these core implementation steps:
- Installation: Follow the official installation guide to add the necessary dependencies to your project.
- App Layout: Define your application's structural layout.
- Initialize App: Set up the Framework7 instance within your Vue application.
- Navigation Router: Configure the router to handle page transitions and mobile-style navigation.
You can also jumpstart your development using official Starter App Templates.
Get started with Framework7 React
masterFramework7 React allows you to build mobile applications by combining the React framework with the Framework7 mobile UI components. To begin building, you should follow these core implementation steps:
- Installation: Follow the official installation guide to add the necessary dependencies to your project.
- App Layout: Define your application's structure using Framework7's layout components.
- Initialize App: Set up the Framework7 instance to manage the application lifecycle.
- Navigation Router: Configure the router to handle page transitions and navigation within your mobile app.
For pre-configured setups, you can use the Starter App Templates to jumpstart your development.
Install Framework7 dependencies
masterTo begin developing with the Framework7 source repository, install all necessary dependencies using npm:
$ npm installGet started with Framework7 Svelte
masterTo begin building a mobile app with Framework7 and Svelte, follow these key steps:
- Installation: Follow the official Installation Guide to set up your environment.
- Templates: Use Starter App Templates to jumpstart your project with a pre-configured structure.
- App Layout: Define your application's structure using the App Layout patterns.
- Initialization: Use the Initialize App process to boot up the Framework7 instance within your Svelte application.
- Navigation: Implement page transitions and routing using the Navigation Router.
Run Framework7 Kitchen Sink examples
masterThe Kitchen Sink allows you to run and explore the Framework7 components in a development environment. These commands build the required development version of the package before running the corresponding Kitchen Sink.
core: Builds Core (vanilla JS) and runs the Core Kitchen Sink.react: Builds the Framework7 React package and runs the React Kitchen Sink.vue: Builds the Framework7 Vue package and runs the Vue Kitchen Sink.svelte: Builds the Framework7 Svelte package and runs the Svelte Kitchen Sink.
# Example: Run the Vue Kitchen Sink npm run vueConfigure Babel for Svelte in Framework7
masterThe
babel-svelte.config.jsfile defines the Babel presets used when compiling Svelte components within the Framework7 ecosystem. It primarily controls the module transformation behavior via theMODULESenvironment variable.To control whether Babel transforms ES modules, set the
MODULESenvironment variable:- If
MODULESis set to'esm', module transformation is disabled (set tofalse). - If
MODULESis set to'false', module transformation is disabled. - Otherwise, the value of
MODULESis passed directly to@babel/preset-envto determine the module transformation strategy.
// Example: Disabling module transformation via environment variable MODULES=esm npx framework7-cli build- If
Configure Babel for Framework7 Vue via MODULES environment variable
masterThe Babel configuration for Framework7 Vue projects uses the
MODULESenvironment variable to control how modules are transformed.- If
MODULESis set to'esm', the configuration forcesmodules: falseto preserve ES modules (useful for tree-shaking in bundlers like Webpack or Rollup). - If
MODULESis set to'false', it also forcesmodules: false. - Otherwise, the value of
MODULESis passed directly to@babel/preset-env.
The configuration also enables
loose: truemode in@babel/preset-envto produce faster, more lightweight code.# Example: Preserving ES modules for tree-shaking MODULES=esm npm run build- If
Configure Babel for React with Framework7
masterThe
babel-react.config.jsfile defines the Babel configuration used for React-based Framework7 projects. It utilizes@babel/preset-reactfor JSX transformation and@babel/preset-envfor environment-specific transpilation.Transpilation behavior for ES modules is controlled via the
MODULESenvironment variable:- If
process.env.MODULESis set to'esm', module transformation is disabled (set tofalse). - If
process.env.MODULESis set to'false', module transformation is disabled. - Otherwise, the value of
process.env.MODULESis passed to@babel/preset-envto determine how modules are handled.
// Example: Setting the MODULES env var to control transpilation // To disable module transformation (equivalent to 'esm' or 'false'): // MODULES=esm npm run build module.exports = { presets: ['@babel/preset-react', ['@babel/preset-env', { modules: process.env.MODULES || false, loose: true }]], };- If