{"id":13776227,"url":"https://github.com/mneudert/sass-nginx-module","last_synced_at":"2025-06-13T10:39:49.892Z","repository":{"id":11020368,"uuid":"13349435","full_name":"mneudert/sass-nginx-module","owner":"mneudert","description":"Syntactically Awesome NGINX Module","archived":false,"fork":false,"pushed_at":"2020-05-03T09:47:20.000Z","size":141,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-01T21:54:37.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mneudert.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":"2013-10-05T17:37:10.000Z","updated_at":"2023-08-26T11:24:50.000Z","dependencies_parsed_at":"2022-09-02T04:30:31.146Z","dependency_job_id":null,"html_url":"https://github.com/mneudert/sass-nginx-module","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/mneudert%2Fsass-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Fsass-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Fsass-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Fsass-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mneudert","download_url":"https://codeload.github.com/mneudert/sass-nginx-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902929,"owners_count":20529114,"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":[],"created_at":"2024-08-03T18:00:19.745Z","updated_at":"2025-03-22T03:31:15.741Z","avatar_url":"https://github.com/mneudert.png","language":"Perl","funding_links":[],"categories":["Modules"],"sub_categories":[],"readme":"# Syntactically Awesome NGINX Module\n\nProviding on-the-fly compiling of [Sass](http://sass-lang.com/) files as an NGINX module.\n\nStop thinking about \"sass watch\" shell processes or the integration features of your IDE while still using the power of Sass while developing your websites.\n\nSupported versions of LibSass:\n\n- `3.4.0` (`3.4.9` used on travis)\n- `3.5.0` (`3.5.5` used on travis)\n- `3.6.0` (`3.6.4` used on travis)\n\n### Note\n\nThis module is experimental and only been used in development environments.\n\nYou can, and should, expect some weird bugs from serving unparsed files up to completely deactivating your vhost.\n\nUse with caution!\n\n## Compilation\n\n### Prerequisites\n\nTo be able to compile this module you need [LibSass](https://github.com/sass/libsass) available. For a list of tested, and therefore more or less supported, combinations of LibSass and NGINX versions please refer to the travis environment in `.travis.yml`. Using different versions can result in unexpected behaviour or won't work at all.\n\nAlso ldconfig has to find the library:\n\n```shell\nldconfig -p | grep \"libsass\"\n```\n\nIf it does not show up try to rebuild the index first using *ldconfig* as *root* user and rerun the grep command. Sometimes you need to add the path where LibSass is installed manually to the list of paths ldconfig is looking for libraries in.\n\nThis can be done by adding the path to the *$LD\\_LIBRARY\\_PATH* variable or the file */etc/ld.so.conf*. Either way, please ensure the command above finds your local LibSass installation before proceeding.\n\nDuring compilation the header file `sass.h` has to be available. The files included inside this file are also required. The exact list depends on your LibSass version.\n\n### NGINX\n\nUsing this module is as easy as recompiling NGINX from source:\n\n```shell\ncd /path/to/nginx/src\n./configure --add-module=/path/to/sass-nginx-module\nmake install\n```\n\nOr if you want to have debug logs available:\n\n```shell\ncd /path/to/nginx/src\n./configure --add-module=/path/to/sass-nginx-module --with-debug\nmake install\n```\n\nTo be able to run the unit tests you need additional modules configured:\n\n```shell\ncd /path/to/nginx/src\n\n# configure as static module\n./configure \\\n  --add-module=/projects/public/lua-nginx-module \\\n  --add-module=/projects/private/sass-nginx-module\n\n# configure as dynamic module\n./configure \\\n  --add-module=/projects/public/lua-nginx-module \\\n  --add-dynamic-module=/projects/private/sass-nginx-module\n\nmake install\n```\n\n## Configuration\n\n__Note__: If you have compiled a dynamic module you need to also add the `load_module` directive with the appropriate directory.\n\nThe configuration is pretty straightforward:\n\n```nginx\nserver {\n    location ~ ^.*\\.css$ {\n        sass_compile  on;\n\n        rewrite  ^(.*)\\.css$  $1.scss  break;\n    }\n}\n```\n\nAdd this location block to your server activates the sass compilation.\n\nUsing a rewrite ensures all the magic happens under the hood and you do not have to change your application to load different files.\n\n### Parameters\n\nError Log Level:\n\n```nginx\nlocation / {\n    # same as regular NGINX error log\n    sass_error_log  error;  #default\n}\n```\n\nInclude Path:\n\n```nginx\nlocation / {\n    # windows (semicolon as path sep)\n    sass_include_path  \"/some/dir;/another/dir\";\n\n    # everywhere else (colon as path sep)\n    sass_include_path  \"/some/dir:/another/dir\";\n}\n```\n\nIndentation:\n\n```nginx\nlocation / {\n    sass_indent  \"  \";   # default\n    sass_indent  \"    \";\n}\n```\n\nIndented Syntax (SASS):\n\n```nginx\nlocation / {\n    sass_is_indented_syntax  off; # default\n    sass_is_indented_syntax  on;\n```\n\nLinefeed:\n\n```nginx\nlocation / {\n    sass_linefeed  \"\\n\";                 # default\n    sass_linefeed  \"\\n/* linefeed */\\n\";\n}\n```\n\nPrecision of Fractional Numbers:\n\n```nginx\nlocation / {\n    sass_precision  5; # default\n    sass_precision  3;\n}\n```\n\nOutput Style:\n\n```nginx\nlocation / {\n    sass_output_style  compact;\n    sass_output_style  compressed;\n    sass_output_style  expanded;\n    sass_output_style  nested;     # default\n}\n```\n\nSource Comments:\n\n```nginx\nlocation / {\n    sass_source_comments  off; # default\n    sass_source_comments  on;\n}\n```\n\nSource Map (embedded):\n\n```nginx\nlocation / {\n    sass_source_map_embed  off; # default\n    sass_source_map_embed  on;\n}\n```\n\n\n## Testing\n\n### Prerequisites\n\nThe unit tests use [Test::Nginx](http://github.com/agentzh/test-nginx) and Lua.\n\nPlease ensure your environment meets the following:\n\n- `prove` (perl) is available\n- `libluajit` is installed\n\nTo be able to run them using `prove` (perl).\n\n### Testing Script\n\nIf you fulfill the prerequisites you can use the script `./compile_and_test.sh` to download, compile and test in on go:\n\n```shell\nVER_LIBSASS=3.6.4 \\\n    VER_LUA_NGINX=0.10.15 \\\n    VER_NGINX=1.18.0 \\\n    LUAJIT_LIB=/usr/lib/x86_64-linux-gnu/ \\\n    LUAJIT_INC=/usr/include/luajit-2.0/ \\\n    ./compile_and_test.sh\n```\n\nThe three passed variables `VER_LIBSASS`, `VER_LUA_NGINX` and `VER_NGINX` define the module versions your are using for compilation. If a variable is not passed to the script it will be automatically taken from your environment. An error message will be printed if no value is available.\n\nRunning the compilation and testing using a dynamic module is possible by additionally passing `DYNAMIC=true` to the script.\n\nAll dependencies will automatically be downloaded to the `./vendor` subfolder.\n\nTo skip the compilation (and download) step you can pass the `--nocompile` flag:\n\n```shell\nALL_THE_CONFIGURATION_VARIABLES \\\n    ./compile_and_test.sh --nocompile\n```\n\nPlease be aware that (for now) all the variables are still required for the script to run.\n\nIf you want to only run a single test from the testing folder you can pass it as a parameter to the script (and therefore on to `prove`):\n\n```shell\n# single test\nALL_THE_CONFIGURATION_VARIABLES \\\n    ./compile_and_test.sh t/conf_output-style.t\n\n# single test and --nocompile\nALL_THE_CONFIGURATION_VARIABLES \\\n    ./compile_and_test.sh --nocompile t/conf_output-style.t\n```\n\n## License\n\nLicensed under the [BSD 2 Clause License](https://opensource.org/licenses/BSD-2-Clause).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmneudert%2Fsass-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmneudert%2Fsass-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmneudert%2Fsass-nginx-module/lists"}