{"id":17976217,"url":"https://github.com/cfour-hi/webpack-multi-page","last_synced_at":"2025-03-25T15:31:10.914Z","repository":{"id":39018512,"uuid":"96525685","full_name":"cfour-hi/webpack-multi-page","owner":"cfour-hi","description":"webpack 前端多页项目工程","archived":false,"fork":false,"pushed_at":"2022-12-13T17:36:55.000Z","size":1306,"stargazers_count":162,"open_issues_count":10,"forks_count":28,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-20T13:09:41.018Z","etag":null,"topics":["javascript","multipage","webpack"],"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/cfour-hi.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-07T09:59:46.000Z","updated_at":"2025-01-23T10:22:44.000Z","dependencies_parsed_at":"2023-01-28T13:47:08.249Z","dependency_job_id":null,"html_url":"https://github.com/cfour-hi/webpack-multi-page","commit_stats":null,"previous_names":["cfour-hi/webpack-multi-page","znlbwo/webpack-multi-page"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfour-hi%2Fwebpack-multi-page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfour-hi%2Fwebpack-multi-page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfour-hi%2Fwebpack-multi-page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfour-hi%2Fwebpack-multi-page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfour-hi","download_url":"https://codeload.github.com/cfour-hi/webpack-multi-page/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245489759,"owners_count":20623789,"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":["javascript","multipage","webpack"],"created_at":"2024-10-29T17:22:50.894Z","updated_at":"2025-03-25T15:31:10.403Z","avatar_url":"https://github.com/cfour-hi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-multi-page\n\n\u003e 基于 webpack v4 的前端多页项目工程，适用于展示型站点，比如官网。\n\n## 特性\n\n- 支持 ES6+ 语法，使用 babel 编译，预设 [preset-env](https://babeljs.io/docs/plugins/preset-env/)；\n\n- html 支持 [ejs](http://ejs.co/) 语法，使用 [underscore-template-loader](https://github.com/emaphp/underscore-template-loader) 和 [HtmlWebpackPlugin](https://github.com/jantimon/html-webpack-plugin) 编译，详细语法可查看 [underscore](http://underscorejs.org/#template) 或者 [lodash](https://lodash.com/docs/4.17.4#template) `_.template` 函数部分。另外 underscore-template-loader 提供 [Macros (宏)](https://github.com/emaphp/underscore-template-loader#macros) 的特性可自定义静态内容，内置 _require_ 宏可在页面 html 文件内引入公共 html 组件，比如 header、footer 之类多页面公共组件，并且可以提供参数给组件；\n\n- 已内置第三方 css 库 `normalize.css@^8.0.1` 和 js 库 `jquery@^3.5.1` 可全局使用，无需声明引入；\n\n- html、css、js 文件内资源引用全部使用相对路径并且会自动判断是否转为 base64 格式；\n\n- 支持 css autoprefixer，无需手写浏览器兼容；支持 css @import 语法；\n\n- 打包采用内容 hash，文件内容未改变情况下多次打包不会修改文件名中的 hash 值；\n\n- 无需手动添加页面 webpack entry，只需按照 pages 目录结构添加页面即可；\n\n## 页面目录结构\n\n```\n|-- pages/                        -- 源文件\n|   |-- index.html                  -- 主页面\n|   |-- index.css\n|   |-- index.js\n|   |-- page-a/                     -- page-a 页面\n|       |-- index.html\n|       |-- index.css\n|       |-- index.js\n|       |-- sub-page-a                  -- page-a 子页面\n|           |-- index.html\n|           |-- index.css\n|           |-- index.js\n|   ... (more like page-a)\n```\n\n## 建议\n\n- 打包之后的文件目录是有讲究的，除 .html 之外的资源，全部放在 dist/assets 目录下；\n\n  （可选）打包前将 webpack.conf/utils/constant.js `assetsPublicPath` 的值修改为 CDN 地址，打包后可将 dist/assets 目录直接放到 CDN。\n\n## 使用\n\n[下载项目](https://codeload.github.com/znlbwo/webpack-multi-page/zip/master)\n\n```\n# 安装依赖\n  yarn\n\n# 本地开发\n  npm run serve\n\n# 打包构建\n  npm run build\n```\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfour-hi%2Fwebpack-multi-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfour-hi%2Fwebpack-multi-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfour-hi%2Fwebpack-multi-page/lists"}