{"id":17968229,"url":"https://github.com/lijinke666/add-static-cache-webpack-plugin","last_synced_at":"2025-03-25T09:30:38.797Z","repository":{"id":57173231,"uuid":"96732596","full_name":"lijinke666/add-static-cache-webpack-plugin","owner":"lijinke666","description":":triangular_flag_on_post: webpack plugin - add static cache manifest  file to your project","archived":false,"fork":false,"pushed_at":"2020-07-01T17:24:11.000Z","size":11,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-20T00:22:33.353Z","etag":null,"topics":["cache","html5","manifest","plugin","webpack","webpack2"],"latest_commit_sha":null,"homepage":"","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/lijinke666.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":"2017-07-10T03:34:25.000Z","updated_at":"2019-09-17T03:55:28.000Z","dependencies_parsed_at":"2022-08-24T13:21:28.567Z","dependency_job_id":null,"html_url":"https://github.com/lijinke666/add-static-cache-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijinke666%2Fadd-static-cache-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijinke666%2Fadd-static-cache-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijinke666%2Fadd-static-cache-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijinke666%2Fadd-static-cache-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lijinke666","download_url":"https://codeload.github.com/lijinke666/add-static-cache-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245435009,"owners_count":20614811,"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":["cache","html5","manifest","plugin","webpack","webpack2"],"created_at":"2024-10-29T14:20:39.401Z","updated_at":"2025-03-25T09:30:38.791Z","avatar_url":"https://github.com/lijinke666.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# add-static-cache-webpack-plugin\nadd static cache manifest  file in yours project , webpack build after create HTML5 Cache Manifest File , add your css,image,fonts in this cahce file \n\n## Installation\n```\nnpm install add-static-cache-webpack-plugin --save-dev\n```\n### How to Use ?\n\n- webpack.config.js\n```javascript\nconst AddStaticCachePlugin = require('add-static-cache-webpack-plugin')\n\n...\n\nmodule.exports = {\n  ...\n  plugins: [\n    new AddStaticCachePlugin({\n      tempalte:\"\",                    // Not required Default template  See the instructions below\n      cacheName:\"jinke.appcache\",     // Not required Default `app.appcache`\n      comments:\"I am commnets\",       // Not required Default `add static cache webpack plugin appCache`\n      publicPath:\"/\"                  // Not required Default create temp file in your `webpack.config.js` `output options publicPath`\n    })\n  ]\n};\n```\n\n### options\n--- \n- #### template\n  - type : `String`\n  - default : `{DEFAULT TEMP FILE}`\n- #### cacheName\n  - type : `String`\n  - default : `'app.appcache'`\n- #### comments\n  - type : `String`\n  - default : `'add static cache webpack plugin appCache'`\n- #### publicPath\n  - type : `String`\n  - default : \"\"\n  \n ---\n \n ### DEFAULT TEMP FILE\n ```\n     const defaultTpl = ` \n          CACHE MANIFEST\n          # add static cache webpack plugin appCache\n          # {date}\n          {cssPath}\n          {fontsPath}\n          {imagesPath}\n          {jsPath}\n\n\n          NETWORK:\n          *\n    `\n ```\n\n ### temp placeholder\n - ##### {date}\n - ##### {cssPath}\n - ##### {jsPath}\n - ##### {fontsPath}\n - ##### {comments}\n \n ### if your want custom template like\n `mkdir my.tpl`\n ```\n   CACHE MANIFEST\n  # {comments}\n  # {date}\n  {cssPath}\n  {fontsPath}\n  {jsPath}\n  {imagesPath}\n\n  NETWORK:\n  *\n\n  FALLBACK\n  # feestyle\n  /static/ /404.html\n  \n ```\n #### Then\n \n ```javascript\n     new AddStaticCachePlugin({\n      tempalte:\"./my.tpl\",                    // Not required Default template  See the instructions below\n      cacheName:\"demo.appcache\",     // Not required Default `app.appcache`\n      comments:\"I am commnets\",       // Not required Default `add static cache webpack plugin appCache`\n      publicPath:\"/static/\"                  // Not required Default create temp file in your `webpack.config.js` `output options publicPath`\n    })\n ```\n \n #### It looks something like this after compilation\n \n `/static/demo.appcache`\n ```\n CACHE MANIFEST\n# I an comments\n# 2017/7/10 16:40:00\n/static/css/app.e2bba250.css\n\n/static/js/app.746fs3.js\n\n/static/fonts/iconfont13955767.svg\n/static/fonts/iconfonta5689859.ttf\n/static/fonts/iconfont75dce69e.eot\n/static/fonts/iconfont57b7441e.woff\n\n/static/images/banner1942579a6.jpg\n/static/images/head_img_s09e1d321.jpg\n\n\nNETWORK:\n*\n\nFALLBACK\n# feeStyle\n/static/ /404.html\n ```\n \n #### Then\n ##### Import him in your `html` file\n ##### If your use `html-webpack-plugin`  You can omit this step It will be auto import :)\n \n ```javascript\n\u003chtml lang=\"zh\" manifest=\"/static/demo.appcache\"\u003e\n...\n\u003c/html\u003e\n ```\n \n `F12` look Application =\u003e Cache =\u003e Application Cache \n There should be your cache :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flijinke666%2Fadd-static-cache-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flijinke666%2Fadd-static-cache-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flijinke666%2Fadd-static-cache-webpack-plugin/lists"}