{"id":14982211,"url":"https://github.com/yodasws/webtoolkit","last_synced_at":"2025-06-28T17:07:33.252Z","repository":{"id":47304004,"uuid":"111107817","full_name":"YodasWs/webtoolkit","owner":"YodasWs","description":"Gulp toolkit to quickly and easily set up a Single Page Application","archived":false,"fork":false,"pushed_at":"2025-05-04T02:55:23.000Z","size":2072,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T20:07:58.927Z","etag":null,"topics":["gulp","gulp-js","gulp-starter","gulp-tasks","gulpfile","gulpjs","html-template","html5-template","javascript","javascript-tools","js","js-template","js-tool","webtoolkit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YodasWs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"YodasWs"}},"created_at":"2017-11-17T13:42:30.000Z","updated_at":"2025-05-04T02:55:26.000Z","dependencies_parsed_at":"2025-04-28T02:21:24.569Z","dependency_job_id":null,"html_url":"https://github.com/YodasWs/webtoolkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/YodasWs/webtoolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodasWs%2Fwebtoolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodasWs%2Fwebtoolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodasWs%2Fwebtoolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodasWs%2Fwebtoolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YodasWs","download_url":"https://codeload.github.com/YodasWs/webtoolkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodasWs%2Fwebtoolkit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262465750,"owners_count":23315638,"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":["gulp","gulp-js","gulp-starter","gulp-tasks","gulpfile","gulpjs","html-template","html5-template","javascript","javascript-tools","js","js-template","js-tool","webtoolkit"],"created_at":"2024-09-24T14:04:57.676Z","updated_at":"2025-06-28T17:07:33.234Z","avatar_url":"https://github.com/YodasWs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/YodasWs"],"categories":[],"sub_categories":[],"readme":"# webtoolkit\nGulp toolkit to quickly and easily set up a Single Page Application\n\n## Initialization\n\nUse the project as a repo template in GitHub [here](https://github.com/YodasWs/webtoolkit/generate).\n\nThen run the following command line instructions:\n```bash\nyarn\n\nvim package.json # to edit your project URLs, name, etc.\n\ngulp init -n \u003csite title\u003e\n\ngulp -? # to list all tasks the tool provides\n```\n\n## Build the Site\n```bash\ngulp\n```\n\nThe default task will compile all the HTML, CSS, and JavaScript, then run a local HTTP server for you to view the results in your browser at http://localhost:3000/\n\nWhile the server is running, any changes you make to the site files will automatically call the process to re-compile and then reload the page in your browser.\n\n## Add Pages\n```bash\ngulp generate:page -n \u003cpage name\u003e [-s \u003csection name\u003e]\n```\n\nThis will build a new blank page for your site, with the following files:\n```\nsrc/pages/\u003cpage name\u003e\nsrc/pages/\u003cpage name\u003e/\u003cpage name\u003e.html\nsrc/pages/\u003cpage name\u003e/\u003cpage name\u003e.scss\nsrc/pages/\u003cpage name\u003e/ctrl.js\n```\n\nThen when you run `generate:page` and include a `\u003csection name\u003e`, your page will be placed in a child folder inside the section folder:\n```\nsrc/pages/\u003csection name\u003e/\u003cpage name\u003e\nsrc/pages/\u003csection name\u003e/\u003cpage name\u003e/\u003cpage name\u003e.html\nsrc/pages/\u003csection name\u003e/\u003cpage name\u003e/\u003cpage name\u003e.scss\nsrc/pages/\u003csection name\u003e/\u003cpage name\u003e/ctrl.js\n```\n\n### Sections\n\nSections are the basic way to organize similar pages together into a parent directory.\n\n```bash\ngulp generate:section -n \u003csection name\u003e\n```\n\nThis creates a new blank page for your site, with the following files,\n\n```\nsrc/pages/\u003csection name\u003e\nsrc/pages/\u003csection name\u003e/index.html\nsrc/pages/\u003csection name\u003e/\u003csection name\u003e.scss\nsrc/pages/\u003csection name\u003e/ctrl.js\n```\n\nIf you want to add a page that doesn't require its own JavaScript or stylesheet files, you can simply add an extra HTML file in the section folder:\n```\nsrc/pages/\u003csection name\u003e/\u003cpage name\u003e.html\n```\n\nThe section route controller is already set up to open up the pages in the browser:\n\n```\n/#!/\u003csection_name\u003e/\u003cpage_name\u003e/\n```\n\n## Page JavaScript\nEach page has a JavaScript file that sets the route to load the page when requested and handle any other code you want called after the page is loaded:\n```javascript\nyodasws.page('pageFirst').setRoute({\n\ttitle: 'First Page',                // The title of the page to display in the browser title bar\n\ttemplate: 'pages/first/first.html', // The page to the HTML page to load\n\tcanonicalRoute: '/first/',          // The URL you want in the browser address bar\n\troute: '/first/?',                  // A RegExp string that will load this page when called in the address bar\n}).on('load', () =\u003e {\n\t// Any JavaScript code you want called when the page loads in the browser\n});\n```\n\nSo for the above page code, going to `http://localhost:3000/#!/first` will load the page and the address will be updated to `http://localhost:3000/#!/first/`.\n\n### Template Function\nThe route's `template` can be a function for greater control and flexibility than simply loading the same file for every route matched.\n\nThe parameters passed to the `template` function are the results of `window.location.hash.replace('#!', '').match(route)`.\n\nThe function is expected to either return a string giving the address of the HTML file to load, or an object that extends the route object and includes, at minimum,\nthe `template` key as a string.\n\n```javascript\nyodasws.page('pageFirst').setRoute({\n\ttitle: 'First Page',\n\troute: '/section-one(/.*)*',\n\ttemplate(match, ...p) {\n\t\treturn {\n\t\t\tcanonicalRoute: '/section-one/' + p.filter(p =\u003e !!p).map(p =\u003e p.replace(/^\\/+|\\/+$/g, '')).join('/') + '/',\n\t\t\ttemplate: 'pages/seciont-one/' + p.filter(p =\u003e !!p).map(p =\u003e p.replace(/^\\/+|\\/+$/g, '')).join('.') + '.html',\n\t\t};\n\t},\n});\n```\n\n## Page JavaScript\nEach page has a JavaScript file that sets the route to load the page when requested and handle any other code you want called after the page is loaded:\n```javascript\nyodasws.page('pageFirst').setRoute({\n\ttitle: 'First Page',                // The title of the page to display in the browser title bar\n\ttemplate: 'pages/first/first.html', // The page to the HTML page to load\n\tcanonicalRoute: '/first/',          // The URL you want in the browser address bar\n\troute: '/first/?',                  // A RegExp string that will load this page when called in the address bar\n}).on('load', () =\u003e {\n\t// Any JavaScript code you want called when the page loads in the browser\n});\n```\n\nSo for the above page code, going to `http://localhost:3000/#!/first` will load the page and the address will be updated to `http://localhost:3000/#!/first/`.\n\n### Template Function\nThe route's `template` can be a function for greater control and flexibility than simply loading the same file for every route matched.\n\nThe parameters passed to template function are the results of `window.location.hash.replace('#!', '').match(route)`.\n\nThe function is expected to either return a string giving the address of the HTML file to load, or an object that extends the route object and includes, at minimum,\nthe `template` key as a string.\n\n```javascript\nyodasws.page('pageFirst').setRoute({\n\ttitle: 'First Page',\n\troute: '/section-one(/.*)*',\n\ttemplate(match, ...p) {\n\t\treturn {\n\t\t\tcanonicalRoute: '/section-one/' + p.filter(p =\u003e !!p).map(p =\u003e p.replace(/^\\/+|\\/+$/g, '')).join('/') + '/',\n\t\t\ttemplate: 'pages/seciont-one/' + p.filter(p =\u003e !!p).map(p =\u003e p.replace(/^\\/+|\\/+$/g, '')).join('.') + '.html',\n\t\t};\n\t},\n});\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodasws%2Fwebtoolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyodasws%2Fwebtoolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodasws%2Fwebtoolkit/lists"}