{"id":13402220,"url":"https://github.com/zuixjs/zuix-html-pwa","last_synced_at":"2026-04-06T11:04:18.930Z","repository":{"id":42495781,"uuid":"144034009","full_name":"zuixjs/zuix-html-pwa","owner":"zuixjs","description":"Progressive Web App template with a responsive, touch-first layout.","archived":false,"fork":false,"pushed_at":"2022-04-02T22:19:59.000Z","size":6235,"stargazers_count":156,"open_issues_count":1,"forks_count":52,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-07-31T19:34:34.223Z","etag":null,"topics":["app-builder","html","javascript","progressive-web-app","webapp"],"latest_commit_sha":null,"homepage":"https://zuixjs.github.io/zuix-html-pwa/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zuixjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-08T15:33:15.000Z","updated_at":"2024-07-22T18:45:09.000Z","dependencies_parsed_at":"2022-08-24T14:34:28.241Z","dependency_job_id":null,"html_url":"https://github.com/zuixjs/zuix-html-pwa","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuixjs%2Fzuix-html-pwa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuixjs%2Fzuix-html-pwa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuixjs%2Fzuix-html-pwa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuixjs%2Fzuix-html-pwa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zuixjs","download_url":"https://codeload.github.com/zuixjs/zuix-html-pwa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243542832,"owners_count":20307973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-builder","html","javascript","progressive-web-app","webapp"],"created_at":"2024-07-30T19:01:13.111Z","updated_at":"2026-04-06T11:04:18.917Z","avatar_url":"https://github.com/zuixjs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# zuix-html-pwa\n\nA Progressive Web App template with a responsive layout and mobile app look \u0026 feel.\n\nThis template is built with just HTML, JavaScript and CSS so that it can be eventually integrated with your favourite\ndevelopment environment and build tools.\n\n\n## Features\n\n- **P**rogressive **W**eb **A**pp\n- Responsive **touch-first** layout with:\n    * collapsing header/footer\n    * drawer layout (side menu panel)\n    * example news list adapter with lazy-loaded items\n- Modular and component-based structure using zUIx.js\n- In-browser bundler: can pack all resources in a single file and boost-up loading speed\n- PWA LightHouse score 98/100\n\n![LightHouse Report](https://zuixjs.github.io/zuix-html-pwa/images/lighthouse-report.png)\n\n### Demo Website\n\nhttps://zuixjs.github.io/zuix-html-pwa\n\n\n# How to use this template\n\nThe **./source** folder contains the *development* version of the website, while the **./docs** folder the *production*\nbundled version.\n\n## Basic usage\n\nIf you have *Node.js* installed, for a quick setup you can use the integrated web server which will serve files from the\n*./source* folder.  \nInstall the development dependencies with `npm install` and then start the web server:\n\n```\nnpm start\n```\n\nIf you don't want to use the integrated web server, you can setup any other web server by creating a new host with the\nroot path pointing to the *./source* folder.\n\n\n## Site structure in brief\n\nThe main file is the `index.html`. This file includes some layout bits that are located in the `layout/` folder and the\nmain application pages that are located in the `pages/` folder.\n\n```\n./source/\n  layout/\n      footer.css\n      footer.html\n      header.css\n      header.html\n  pages/\n      home.css\n      home.html\n      home/ (folder with other files referenced in home.html/js)\n         items_list.css\n         items_list.html\n         items_list.js\n         items_list/ (folder with other files referenced in items_list.html/js)\n      messages.css\n      messages.html\n      notifications.css\n      notifications.html\n      search.css\n      search.html\n  shared/\n      input_box.css\n      input_box.html\n      input_box.js\n      main_menu.css\n      main_menu.html\n```\n\nA simple page is defined by the `.css` and `.html` files. A page might also require some bits of *JavaScript* in which\ncase also a `.js` file with the same base name is present.\n\nA page might also include some other *local* bits that are placed in a subfolder with the same base name of the page\nlike shown in the above structure for the `home` page.\n\nThe `shared/` folder contains indeed bits that are *shared* across the whole application and that are usually referenced\nby different pages.\n\nAs you can see in the `index.html` file those pages and layout bits are loaded using some special tag attributes that are\n`data-ui-include` (to load simple content pages) and `data-ui-load` to load pages or components that also have a JavaScript controller.\n\n**index.html** (main body)\n```html\n\u003c!-- The header with profile icon button for opening the drawer layout (side menu panel) --\u003e\n\u003cheader data-ui-include=\"layout/header\"\n        data-ui-options=\"options.headerBar\"\u003e\u003c/header\u003e\n\n\u003cmain\u003e\n\n  \u003c!-- HOME --\u003e\n  \u003csection data-ui-include=\"pages/home\"\u003e\u003c/section\u003e\n\n  \u003c!-- SEARCH --\u003e\n  \u003csection data-ui-include=\"pages/search\"\u003e\u003c/section\u003e\n\n  \u003c!-- NOTIFICATIONS --\u003e\n  \u003csection data-ui-include=\"pages/notifications\"\u003e\u003c/section\u003e\n\n  \u003c!-- MESSAGES --\u003e\n  \u003csection data-ui-include=\"pages/messages\"\u003e\u003c/section\u003e\n\n\u003c/main\u003e\n\n\u003c!-- The footer with toolbar buttons --\u003e\n\u003cfooter data-ui-include=\"layout/footer\"\n        data-ui-options=\"options.footerBar\"\u003e\u003c/footer\u003e\n\n\u003c!-- The DrawerLayout used for the app-wide side menu panel --\u003e\n\u003cdiv data-ui-load=\"@lib/controllers/drawer_layout\"\n     data-ui-options=\"options.drawerLayout\"\u003e\n  \u003c!-- Add Navigation Drawer content --\u003e\n  \u003cdiv data-ui-include=\"shared/main_menu\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\nFor a deeper insight on using these special attributes for component-based developemnt with **zUIx.js** see related link\nat the bottom of this page.\n\n### The news list\n\nIn order to display the list of news articles, the `pages/home` is using the `pages/home/items_list` component.\n\n**pages/home.html** (snippet)\n```html\n...\n\n\u003c!-- Top Stories --\u003e\n\u003cdiv data-ui-load=\"pages/home/items_list\"\n     data-o-rss=\"http://rss.cnn.com/rss/edition.rss\"\u003e\u003c/div\u003e\n\n\u003c!-- World News --\u003e\n\u003cdiv data-ui-load=\"pages/home/items_list\"\n     data-o-rss=\"http://rss.cnn.com/rss/edition_world.rss\"\u003e\u003c/div\u003e\n\n...\n```\n\nOnce the `items_list` component is loaded it will read the attribute `data-o-rss` of the element and download the RSS\nfeed specified by it. Then it will parse the RSS feed and render it to the wrapping element.  \nThis component is just an example and you can modify and adapt it to work with any data source or it can be replace with\na server-side rendering approach.\n\n### About the @lib prefix\n\nThe special *@lib* prefix is used with the `data-ui-include` and `data-ui-load` attribute to load components from a\nshared location that by default will point to the [zKit](https://zuixjs.github.io/zkit/) components library.  \nThis path is resolved to `https://zuixjs.github.io/zkit/lib/` but can also be customized to point to a different location:\n\n```javascript\nzuix.store('config', {\n    libraryPath: 'https://my.shared.components.io/lib/'\n});\n```\n\nYou can so create your own shared component library to use across all of your websites.\n\n### Further implementation details\n\nIf you have more questions about how to use this template, do not hesitate to [file an issue](https://github.com/zuixjs/zuix-html-pwa/issues).\n\n\n## Service Worker and Offline mode\n\nA service worker is also included with this template. This is a script (`sw.js`) that runs in the background as a separate\nthread from the main page and takes care of providing caching of most resources with a fallback mechanism in presence of\nnetwork errors.  \nThis makes the application to launch even if there's no network connection, like with a real mobile app. It also provides\na configurable `404.html` *\"not found\"* page and `offline.html` page.  \nWhen publishing a new version of the application the *version number* found at the top of the `sw.js` file **must be increased**\nin order to clean the cache and correctly update the application files.\n\n\n## Debugging\n\nTo enable verbose debugging information in the browser console, comment out the last line in the `index.js` file as\nshown below:\n\n``` javascript\n// Turn off debug output\n//window.zuixNoConsoleOutput = true;\n```\n\n\n## Bundling\n\nBundling is the process of collecting all resources used in a page and then compiling them into a single and optimized file.\n\nThis will drastically narrow down the number of network requests the browser will make to complete the page loading,\nthus resulting in a faster startup.\n\nThere are actually two way of doing this:\n\n- **In-Browser** bundler:\nthis method does not require any build tool nor plugins, it just works in the browser as-is.\n\n- **Web-Starter** bundler:\nis the [zuix-web-starter](https://github.com/zuixjs/zuix-web-starter) bare template, with a bunch of extra features and  \nenhancements. It requires *Node.js* to be installed.\n\nThis template is already configured for **in-browser** bundling.\n\n### In-Browser bundling\n\nWhen the website is ready for production you can decide to bundle it in order to gain better performances. All of its\ncomponents and resources will be crunched into a single file and loaded from memory rather than from network/localhost.\n\n#### Step by step guide\n\nOpen the development website and generate the application bundle by typing in the **browser console** the command\n\n```javascript\nzuix.saveBundle()\n```\n\nThis will create and save the **app.bundle.js** file to the *Downloads* folder.\n\nCopy all files from the *source* folder to the **production** folder (*./docs*) with the exception of *./components*,\n*./controllers*, *./pages*, *./layout* and *./index.css*.\n\nThese folders contain *zuix* components and pages that are already packed in the *app.bundle.js* file.\n\nCopy *app.bundle.js* to the *production* folder. Edit the `index.html` file in the *production* folder and in the `head`\nsection replace the `js/zuix-bundler.min.js` script import with `app.bundle.js`.\n\n```html\n\u003cscript src=\"js/zuix.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"app.bundle.js\"\u003e\u003c/script\u003e\n```\n\nYou can also remove all `js/zuix*.*` files from the *production* folder but keep the `zuix.min.js` one.\n\n#### Remarks\n\nWhen using *lazy-loading* only components loaded so far will be included in the bundle (incremental bundling).\n\nTo force inclusion of all components/resources used in the page, issue the following commands in the console:\n\n```javascript\n// disable lazy-loading\nzuix.lazyLoad(false)\n// force loading of all components\nzuix.componentize()\n// create the bundle\nzuix.saveBundle()\n```\n\nAlso external JavaScript libraries and CSS files can be included in the page bundle. In order to achieve this, remove\nthe `\u003cscript src=\"...\"\u003e\u003c/script\u003e` or `\u003clink rel=\"stylesheet\"\u003e` and instead use the method `zuix.using(...)` to load the script/css.\n\n```javascript\n// Loading a .css style\nconst flaCss = 'https://cdnjs.cloudflare.com/ajax/libs/flex-layout-attribute/1.0.3/css/flex-layout-attribute.min.css';\nzuix.using('style', flaCss, function(res, styleObject) {\n    console.log(\"Added Flex Layout Attributes CSS.\", res, styleObject);\n});\n// Loading a .js script\nconst momentJs = 'https://momentjs.com/downloads/moment.js';\nzuix.using('script', momentJs, function(res, scriptObject){\n    console.log(\"Added Moment.js.\", res, scriptObject);\n});\n```\n\nPlace the *using* commands preferably at the top of `index.js`. You can remove from the *production* folder all files\nimported with the *using* command.\n\n# Further reading\n\n- [zUIx.js](https://zuixjs.org)\n- [zKit](https://zuixjs.github.io/zkit/)\n- [PWA Builder](https://www.pwabuilder.com/)\n- [Progressive Web App](https://developers.google.com/web/progressive-web-apps)\n- [Service Workers](https://developers.google.com/web/fundamentals/primers/service-workers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuixjs%2Fzuix-html-pwa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzuixjs%2Fzuix-html-pwa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuixjs%2Fzuix-html-pwa/lists"}