{"id":15041626,"url":"https://github.com/mdarnall/hapi-sass","last_synced_at":"2025-04-14T20:23:52.857Z","repository":{"id":14582729,"uuid":"17299189","full_name":"mdarnall/hapi-sass","owner":"mdarnall","description":":heart_eyes: A Hapi.js plugin for compiling and serving Sass stylesheets","archived":false,"fork":false,"pushed_at":"2018-10-19T23:41:13.000Z","size":65,"stargazers_count":11,"open_issues_count":1,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T02:23:25.706Z","etag":null,"topics":["hapi-plugin","javascript","node-sass"],"latest_commit_sha":null,"homepage":"","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/mdarnall.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":"2014-02-28T20:42:54.000Z","updated_at":"2020-05-19T03:09:23.000Z","dependencies_parsed_at":"2022-09-08T20:21:40.150Z","dependency_job_id":null,"html_url":"https://github.com/mdarnall/hapi-sass","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdarnall%2Fhapi-sass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdarnall%2Fhapi-sass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdarnall%2Fhapi-sass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdarnall%2Fhapi-sass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdarnall","download_url":"https://codeload.github.com/mdarnall/hapi-sass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248953316,"owners_count":21188618,"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":["hapi-plugin","javascript","node-sass"],"created_at":"2024-09-24T20:46:18.054Z","updated_at":"2025-04-14T20:23:52.830Z","avatar_url":"https://github.com/mdarnall.png","language":"JavaScript","readme":"# hapi-sass\n\nA Hapi.js plugin for compiling and serving Sass stylesheets using [node-sass](https://github.com/andrew/node-sass). This is a port of their express middleware to a hapi.js plugin.\n\n### Overview\n\nThis plugin will create a single (configurable) route on the server that will respond to requests for css files.\n\nThe plugin will map the request to a sass file in the configured `src` directory. The plugin will then try to just serve an existing, compiled `.css` file in the configured `dest` directory. If the file does not exist, or is older than the sass file, it will re-compile, write the file back to disk and respond with the contents back to the requestor.\n\n\n### Example usage:\n\n```shell\n$ npm install hapi-sass --save\n```\n\n```javascript\nconst Hapi = require(\"hapi\");\nconst HapiSass = require(\"../index\");\nconst Inert = require(\"inert\");\n\nconst server = new Hapi.Server({ port: 3000, host: \"localhost\" });\n\nconst options = {\n  src: \"./sass\",\n  dest: \"./css\",\n  force: true,\n  debug: true,\n  routePath: \"/css/{file}.css\",\n  includePaths: [\"./vendor/sass\"],\n  outputStyle: \"nested\",\n  sourceComments: true,\n  functions: require(\"./functions\"),\n  srcExtension: \"sass\"\n};\n\nconst init = async () =\u003e {\n  await server.register([\n    Inert,\n    {\n      plugin: HapiSass,\n      options: options\n    }\n  ]);\n\n  await server.start();\n  console.log(`Server running at: ${server.info.uri}`);\n};\nprocess.on(\"unhandledRejection\", err =\u003e {\n  console.log(err);\n  process.exit(1);\n});\n\ninit();\n```\n\nSee the `example/` folder for more.\n\n### Options:\n\n* `debug`: used to print statements to the console. Defaults to `false`\n* `force`: forces re-compilation for every request. Defaults to `false`\n* `src`: the directory to find the requested `.sass` file. Defaults to `./lib/sass`\n* `srcExtension`: the extension of the requested `.sass` file. Defaults to `scss`\n* `dest`: the destination directory to write compiled `.css` files. Defaults to `./public/css`\n* `routePath`: the route to register with hapijs. Defaults to `/css/{file}.css`. The `{file}` portion of the string is currently significant. It's used as a request parameter.\n* `outputStyle`: [parameter for node-sass](https://github.com/sass/node-sass#outputstyle). Defaults to `compressed`\n* `sourceComments`: [parameter for node-sass](https://github.com/sass/node-sass#sourcecomments). Defaults to `false`.\n* `functions`: [parameter for node-sass](https://github.com/sass/node-sass#functions--v300---experimental) to support custom functions. Defaults to an empty object.  \n* `includePaths`: [parameter for node-sass](https://github.com/sass/node-sass#includepaths). Defaults to `[]`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdarnall%2Fhapi-sass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdarnall%2Fhapi-sass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdarnall%2Fhapi-sass/lists"}