{"id":31895308,"url":"https://github.com/edwjusti/express-preact-views","last_synced_at":"2025-10-13T10:24:00.712Z","repository":{"id":42229474,"uuid":"149964977","full_name":"edwjusti/express-preact-views","owner":"edwjusti","description":"This is an Express view engine which renders Preact components on server.","archived":false,"fork":false,"pushed_at":"2022-04-09T17:04:38.000Z","size":95,"stargazers_count":23,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-11T15:03:35.351Z","etag":null,"topics":["express","preact"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edwjusti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-23T08:41:07.000Z","updated_at":"2025-07-21T06:20:16.000Z","dependencies_parsed_at":"2022-08-20T13:40:11.844Z","dependency_job_id":null,"html_url":"https://github.com/edwjusti/express-preact-views","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/edwjusti/express-preact-views","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwjusti%2Fexpress-preact-views","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwjusti%2Fexpress-preact-views/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwjusti%2Fexpress-preact-views/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwjusti%2Fexpress-preact-views/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edwjusti","download_url":"https://codeload.github.com/edwjusti/express-preact-views/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwjusti%2Fexpress-preact-views/sbom","scorecard":{"id":367676,"data":{"date":"2025-08-11","repo":{"name":"github.com/edwjusti/express-preact-views","commit":"3844429749f045d730ce6d5aea0c221ddb1f03de"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":5,"reason":"Found 1/2 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T12:14:51.394Z","repository_id":42229474,"created_at":"2025-08-18T12:14:51.394Z","updated_at":"2025-08-18T12:14:51.394Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011182,"owners_count":26084900,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["express","preact"],"created_at":"2025-10-13T10:23:59.245Z","updated_at":"2025-10-13T10:24:00.706Z","avatar_url":"https://github.com/edwjusti.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-preact-views\r\n\r\nThis is an [Express][express] view engine forked from [express-react-views](https://github.com/reactjs/express-react-views) which renders [Preact][preact] components on server.\r\n\r\nThis is intended to be used as a replacement for existing server-side view solutions, like [jade][jade], [ejs][ejs], or [handlebars][hbs].\r\n\r\n\r\n## Usage\r\n\r\n```sh\r\nnpm install express-preact-views preact\r\n```\r\n\r\n### Add it to your app.\r\n\r\n```js\r\n// app.js\r\n\r\nconst app = express();\r\n\r\napp.set('views', __dirname + '/views');\r\napp.set('view engine', 'jsx');\r\napp.engine('jsx', require('express-preact-views').createEngine());\r\n```\r\n\r\n### Options\r\noption | values | default\r\n-------|--------|--------\r\n`doctype` | any string that can be used as [a doctype](http://en.wikipedia.org/wiki/Document_type_declaration), this will be prepended to your document | `\"\u003c!DOCTYPE html\u003e\"`\r\n`beautify` | `true`: beautify markup before outputting (note, this can affect rendering due to additional whitespace) | `false`\r\n`transformViews` | `true`: use `babel` to apply JSX, ESNext transforms to views.\u003cbr\u003e**Note:** if already using `babel-register` in your project, you should set this to `false` | `true`\r\n`babel` | any object containing valid Babel options\u003cbr\u003e**Note:** does not merge with defaults | `{presets: ['preact', [ 'env', {'targets': {'node': 'current'}}]]}`\r\n\r\nThe defaults are sane, but just in case you want to change something, here's how it would look:\r\n\r\n```js\r\nconst options = { beautify: true };\r\napp.engine('jsx', require('express-preact-views').createEngine(options));\r\n```\r\n\r\n\r\n### Views\r\n\r\nUnder the hood, [Babel][babel] is used to compile your views to code compatible with your current node version, using the [preact][babel-preset-preact] and [env][babel-preset-env] presets by default. Only the files in your `views` directory (i.e. `app.set('views', __dirname + '/views')`) will be compiled.\r\n\r\nYour views should be node modules that export a preact component. Let's assume you have this file in `views/index.jsx`:\r\n\r\n```js\r\nimport { h, Component } from 'preact';\r\n\r\nclass HelloMessage extends Component {\r\n  render() {\r\n    return \u003cdiv\u003eHello {this.props.name}\u003c/div\u003e;\r\n  }\r\n}\r\n\r\nexport default HelloMessage;\r\n```\r\n\r\n### Routes\r\n\r\nYour routes would look identical to the default routes Express gives you out of the box.\r\n\r\n```js\r\n// app.js\r\nimport index from './routes';\r\n\r\napp.get('/', index);\r\n```\r\n\r\n```js\r\n// routes/index.js\r\n\r\nexport default function(req, res){\r\n  res.render('index', { name: 'John' });\r\n};\r\n```\r\n\r\n**That's it!** Layouts follow really naturally from the idea of composition.\r\n\r\n### Layouts\r\n\r\nSimply pass the relevant props to a layout component.\r\n\r\n`views/layouts/default.jsx`:\r\n```js\r\nimport { h, Component } from 'preact';\r\n\r\nclass DefaultLayout extends Component {\r\n  render() {\r\n    return (\r\n      \u003chtml\u003e\r\n        \u003chead\u003e\u003ctitle\u003e{this.props.title}\u003c/title\u003e\u003c/head\u003e\r\n        \u003cbody\u003e{this.props.children}\u003c/body\u003e\r\n      \u003c/html\u003e\r\n    );\r\n  }\r\n}\r\n\r\nexport default DefaultLayout;\r\n```\r\n\r\n`views/index.jsx`:\r\n```js\r\nimport { h, Component } from 'preact';\r\nimport DefaultLayout from './layouts/default';\r\n\r\nclass HelloMessage extends Component {\r\n  render() {\r\n    return (\r\n      \u003cDefaultLayout title={this.props.title}\u003e\r\n        \u003cdiv\u003eHello {this.props.name}\u003c/div\u003e\r\n      \u003c/DefaultLayout\u003e\r\n    );\r\n  }\r\n}\r\n\r\nexport default HelloMessage;\r\n```\r\n\r\n[express]: http://expressjs.com/\r\n[preact]: https://preactjs.com\r\n[jade]: http://jade-lang.com/\r\n[ejs]: http://embeddedjs.com/\r\n[hbs]: https://github.com/barc/express-hbs\r\n[babel]: https://babeljs.io/\r\n[babel-preset-preact]: https://github.com/developit/babel-preset-preact\r\n[babel-preset-env]: https://babeljs.io/docs/plugins/preset-env/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwjusti%2Fexpress-preact-views","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwjusti%2Fexpress-preact-views","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwjusti%2Fexpress-preact-views/lists"}