Framework7 Package Structure
Package
Framework7 core library contains the following files and folders:
framework7/
components/
accordion/
accordion.js
accordion.less
accordion.css
accordion.js
actions/
actions.js
actions.less
actions.css
actions.js
...
js/
framework7.bundle.js
framework7.bundle.min.js
framework7.js
framework7.min.js
css/
framework7.bundle.css
framework7.bundle.min.css
framework7.bundle.rtl.css
framework7.bundle.rtl.min.css
framework7.css
framework7.min.css
framework7.rtl.css
framework7.rtl.min.css
framework7.esm.bundle.js
framework7.esm.js
framework7.bundle.less
framework7.less
Styles
Main Framework7 styles are located in css/
folder:
framework7.css
- contains minimal (core) Framework7 styles with minimal required set of components.framework7.rtl.css
- same but for RTL layout.framework7.bundle.css
- contains styles for Framework7 core version and includes styles for all components.framework7.bundle.rtl.css
- same but for RTL layout.
Scripts (UMD)
In js/
folder there are so called UMD JavaScript files intended to be used directly in browser (e.g. with <script src="...">
) or with libraries like Require.js:
framework7.js
- contains minimal (core) Framework7 version with minimal required set of components.framework7.bundle.js
- contains whole Framework7 with all its components.
Components
All components are located in components/
folder and required to be used with core (not bundle) version. You can learn more about how to use them in lazy modules section.
ES Module
This feature currently can be used in bundlers like Webpack and Rollup
Framework7 can also be imported as an ES-next module:
import Framework7 from 'framework7';
Framework7 has modular structure and by default it exports only core Framework7 with core components.
And if you need additional components they must be included additionally:
// Import core framework
import Framework7 from 'framework7';
// Import additional components
import Searchbar from 'framework7/components/searchbar/searchbar.js';
import Calendar from 'framework7/components/calendar/calendar.js';
import Popup from 'framework7/components/popup/popup.js';
// Install F7 Components using .use() method on class:
Framework7.use([Searchbar, Calendar, Popup]);
// Init app
var app = new Framework7({/*...*/});
Such modular structure provides best tree-shaking results and package size optimization.
In addition to default
export it has named export for Template7
, Dom7
, Request
, Device
, Utils
and Support
libraries:
import Framework7, { Device, Request } from 'framework7';
var app = new Framework7({/*...*/});
if (Device.ios) {
Request.get('http://google.com');
}
ES Module Bundle
If you need to include Framework7 with all components, we can include its another script bundle with all components installed:
// Import framework with all components
import Framework7 from 'framework7/framework7.esm.bundle.js';
// Init app
var app = new Framework7({/*...*/});
ES-Next
Note, that Framework7 ES modules are in ES-next syntax, so don’t forget to enable/configure your Babel/Buble to transpile them as well, as well as template7
, dom7
and ssr-window
modules that used as dependencies.