{"id":16440358,"url":"https://github.com/constgen/neutrino-middleware-stylus-loader","last_synced_at":"2026-05-14T17:42:23.682Z","repository":{"id":65457058,"uuid":"295388816","full_name":"constgen/neutrino-middleware-stylus-loader","owner":"constgen","description":"Neutrino Stylus loader middleware","archived":false,"fork":false,"pushed_at":"2020-09-14T17:08:33.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T22:03:40.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/constgen.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":"2020-09-14T11:02:05.000Z","updated_at":"2020-09-14T17:08:35.000Z","dependencies_parsed_at":"2023-01-24T12:05:12.648Z","dependency_job_id":null,"html_url":"https://github.com/constgen/neutrino-middleware-stylus-loader","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/constgen%2Fneutrino-middleware-stylus-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/constgen%2Fneutrino-middleware-stylus-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/constgen%2Fneutrino-middleware-stylus-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/constgen%2Fneutrino-middleware-stylus-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/constgen","download_url":"https://codeload.github.com/constgen/neutrino-middleware-stylus-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766672,"owners_count":19854114,"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-10-11T09:11:55.559Z","updated_at":"2026-05-14T17:42:23.619Z","avatar_url":"https://github.com/constgen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neutrino Stylus loader middleware\n\n[![npm](https://img.shields.io/npm/v/neutrino-middleware-stylus-loader.svg)](https://www.npmjs.com/package/neutrino-middleware-stylus-loader)\n[![npm](https://img.shields.io/npm/dt/neutrino-middleware-stylus-loader.svg)](https://www.npmjs.com/package/neutrino-middleware-stylus-loader)\n\n`neutrino-middleware-stylus-loader` is a [Neutrino](https://neutrino.js.org) middleware for compiling styles with [Stylus](https://stylus-lang.com/). This middleware only transforms Stylus to CSS. It is recommended to have `@neutrinojs/style-loader` (or its substitution) in the configuration to be able to compile Stylus styles to JavaScript modules.\n\n## Features\n\n- Compatible with any other middlewares. Requires `style` rule to be defined before.\n- Include `nib` extension by default. You can `@import 'nib'` in your code\n\n## Requirements\n\n* Node.js v10.13+\n* Neutrino v9\n\n## Installation\n\n`neutrino-middleware-stylus-loader` can be installed from NPM. You should install it to `\"dependencies\"` (--save) or `\"devDependncies\"` (--save-dev) depending on your goal.\n\n```bash\nnpm install --save-dev neutrino-middleware-stylus-loader\n```\n\n## Usage\n\n`neutrino-middleware-stylus-loader` can be consumed from the Neutrino API, middleware, or presets.\n\n### In preset\n\nRequire this package and plug it into Neutrino. The following shows how you can pass an options object to the middleware, showing the defaults:\n\n```js\nlet stylusLoader = require('neutrino-middleware-stylus-loader')\n\nneutrino.use(stylusLoader({\n   include: ['src', 'test'],\n   exclude: [],\n   stylus : {\n      paths  : ['node_modules'],\n      use    : [nib()],\n      import : ['nib'],\n      include: [],\n      define : [\n         // [key, value, raw]\n      ],\n      includeCSS: true,\n      resolveUrl: true\n   }\n}))\n```\n\n- `include`: optional array of paths to include in the compilation. Maps to Webpack's rule.include.\n- `exclude`: optional array of paths to exclude from the compilation. Maps to Webpack's rule.include.\n- `stylus`: optional [Stylus options](https://stylus-lang.com/docs/js.html) config that is passed to the loader.\n\nIt is recommended to call this middleware after the `neutrino.config.module.rule('style')` to make it work properly. More information about usage of Neutrino middlewares can be found in the [documentation](https://neutrino.js.org/middleware).\n\n### In **neutrinorc**\n\nThe middleware also may be used together with another presets in Neutrino rc-file, e.g.:\n\n**.neutrinorc.js**\n\n```js\nlet web    = require('@neutrino/web')\nlet stylus = require('neutrino-middleware-stylus-loader')\n\nmodule.exports = {\n   use: [\n      web(),\n      stylus()\n   ]\n}\n```\n\n### Imports paths\n\nThe loader can resolve paths in one of two modes: Stylus or Webpack.\n\nWebpack's resolver is used by default. To use its advantages to look up the `modules` you need to prepend `~` to the path:\n\n```css\n@import \"~bootstrap/stylus/bootstrap\";\n```\n\nOtherwise the path will be determined as a relative URL, `@import \"file\"` is the same as `@import \"./file\"`\n\n### Plugins\n\n\u003e This middleware already includes `nib` plugin by default. So you don't need to include it by yourself\n\nIn order to use Stylus plugins, simply add them to the the `use` option:\n\n```js\nlet myStylusPlugin = require('my-stylus-plugin')\n\nneutrino.use(stylusLoader({\n   stylus: {\n      use: [myStylusPlugin()]\n   }\n}))\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconstgen%2Fneutrino-middleware-stylus-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconstgen%2Fneutrino-middleware-stylus-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconstgen%2Fneutrino-middleware-stylus-loader/lists"}