Framework7 Custom Build

    1. Download and unzip to local folder

    2. Install Node.js (if not installed)

    3. Install Gulp (if not installed) by executing the following command in terminal:

    4. Now, we need to install required dependencies. Go to the folder with downloaded and unzipped Framework7 repository and execute in terminal:

    5. Copy scripts/build-config.js file to some place in the downloaded folder and rename it let’s say to scripts/my-config.js

    6. Open this file and remove components that you don’t need or modify color theme and included colors:

      1. /* my-config.js */
      2. const config = {
      3. target: 'universal',
      4. rtl: false, // change to true to generate RTL styles
      5. // remove any components you don't need
      6. components: [
      7. 'dialog',
      8. 'popup',
      9. 'login-screen',
      10. 'popover',
      11. 'actions',
      12. 'sheet',
      13. 'toast',
      14. 'preloader',
      15. 'progressbar',
      16. 'sortable',
      17. 'swipeout',
      18. 'accordion',
      19. 'contacts-list',
      20. 'virtual-list',
      21. 'timeline',
      22. 'tabs',
      23. 'panel',
      24. 'card',
      25. 'chip',
      26. 'form',
      27. 'input',
      28. 'checkbox',
      29. 'radio',
      30. 'toggle',
      31. 'range',
      32. 'stepper',
      33. 'smart-select',
      34. 'grid',
      35. 'calendar',
      36. 'picker',
      37. 'infinite-scroll',
      38. 'pull-to-refresh',
      39. 'lazy',
      40. 'fab',
      41. 'searchbar',
      42. 'messages',
      43. 'messagebar',
      44. 'swiper',
      45. 'photo-browser',
      46. 'notification',
      47. 'autocomplete',
      48. 'tooltip',
      49. 'gauge',
      50. 'vi',
      51. 'typography',
      52. ],
      53. // include/exclude dark theme styles
      54. darkTheme: true,
      55. // include/exclude themes
      56. themes: [
      57. 'ios',
      58. 'md',
      59. // modify colors
      60. ios: {
      61. themeColor: '#007aff',
      62. colors: {
      63. red: '#ff3b30',
      64. green: '#4cd964',
      65. blue: '#007aff',
      66. pink: '#ff2d55',
      67. yellow: '#ffcc00',
      68. orange: '#ff9500',
      69. gray: '#8e8e93',
      70. white: '#ffffff',
      71. black: '#000000',
      72. },
      73. },
      74. md: {
      75. themeColor: '#2196f3',
      76. colors: {
      77. red: '#f44336',
      78. green: '#4caf50',
      79. blue: '#2196f3',
      80. pink: '#e91e63',
      81. yellow: '#ffeb3b',
      82. orange: '#ff9800',
      83. gray: '#9e9e9e',
      84. white: '#ffffff',
      85. black: '#000000',
      86. },
      87. },
      88. };
      89. module.exports = config;
    7. That is all. Now you should see newly generated js and css files in specified output folder

    8. If you are in hurry and want to see how its working then do follow step 1 to 4

      1. $ npm run build-core:dev

      The result is available in build/ folder.

    9. To build production version of Framework7:

      1. $ npm run build-core:prod

      Production version will be available in dist/ folder.

    10. Run Kitchen Sink with development environment

      1. $ npm run core:prod
    11. Kitchen Sink is live

      Visit From Youre Browser

    If you use bundler like Webpack or Rollup you can use only required Framework7 JS components without that build process and by importing only required components:

    1. // Import core framework
    2. import Framework7 from 'framework7';
    3. // Import additional components
    4. import Searchbar from 'framework7/components/searchbar/searchbar.js';
    5. import Calendar from 'framework7/components/calendar/calendar.js';
    6. import Popup from 'framework7/components/popup/popup.js';
    7. // Install F7 Components using .use() method on Framework7 class:
    8. Framework7.use([Searchbar, Calendar, Popup]);
    9. // Init app
    10. var app = new Framework7({/*...*/});

    The following components are available for importing (all other components are part of the core):

    Framework7 styles are build with Less.js. If you use Less and NPM in your app/project then you can easily create custom framework7 stylesheet with only components you need.

    Create your own framework7.less file:

    1. // core
    2. @import url('path/to/node_modules/framework7/framework7.less');
    3. // import only components you need
    4. @import url('path/to/node_modules/framework7/components/searchbar/searchbar.less');
    5. @import url('path/to/node_modules/framework7/components/calendar/calendar.less');
    6. @import url('path/to/node_modules/framework7/components/popup/popup.less');
    7. // include/exclude themes
    8. @includeIosTheme: true;
    9. @includeMdTheme: true;
    10. // include/exclude dark theme
    11. @includeDarkTheme: true;
    12. // iOS theme color
    13. @themeColorIos: #007aff;
    14. // MD theme color
    15. @themeColorMd: #2196f3;
    16. // Extra colors for iOS theme
    17. @colorsIos: red #ff3b30, green #4cd964, blue #007aff, pink #ff2d55, yellow #ffcc00, orange #ff9500, gray #8e8e93, white #ffffff, black #000000;
    18. // Extra colors for MD theme
    19. @colorsMd: red #f44336, green #4caf50, blue #2196f3, pink #e91e63, yellow #ffeb3b, orange #ff9800, gray #9e9e9e, white #ffffff, black #000000;
    20. @rtl: false;