# gulp-stylus

> Stylus plugin for gulp

Latest version **3.0.1** (published 2023-07-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-stylus
pnpm add gulp-stylus
yarn add gulp-stylus
bun add gulp-stylus
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2023-07-12 |
| First published | 2013-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gulp-stylus) |
| Module format | CommonJS |
| Node | >= 4.2.0 |
| Dependencies | 7 |
| Unpacked size | 20.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 220 |
| Author | Steve Lacy |
| Maintainers | stevelacy |
| Keywords | gulp, stylus, css, preprocessor, gulpplugin, gulp-plugin |

## Links

- npm: https://www.npmjs.com/package/gulp-stylus
- Repository: https://github.com/stevelacy/gulp-stylus
- Homepage: http://github.com/stevelacy/gulp-stylus
- Issues: https://github.com/stevelacy/gulp-stylus/issues
- npm.io page: https://npm.io/package/gulp-stylus

## Dependencies (7)

- [accord](https://npm.io/package/accord.md) ^0.30.0
- [stylus](https://npm.io/package/stylus.md) ^0.59.0
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [replace-ext](https://npm.io/package/replace-ext.md) 2.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^2.0.1
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^4.2.0
- [vinyl-sourcemaps-apply](https://npm.io/package/vinyl-sourcemaps-apply.md) ^0.2.1

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2023-07-12
- 3.0.0 — 2022-12-08
- 2.7.1 — 2021-12-31
- 2.7.0 — 2017-12-25
- 2.6.0 — 2016-11-01
- 2.5.0 — 2016-06-21
- 2.4.0 — 2016-05-25
- 2.3.1 — 2016-03-08
- 2.3.0 — 2016-01-28
- 2.2.0 — 2015-12-31
- 2.1.2 — 2015-12-22
- 2.1.1 — 2015-12-03
- 2.1.0 — 2015-10-05
- 2.0.7 — 2015-09-14
- 2.0.6 — 2015-07-31
- … 34 more at https://npm.io/package/gulp-stylus/versions

## README

# gulp-stylus
[![Build Status](https://travis-ci.org/stevelacy/gulp-stylus.png?branch=master)](https://travis-ci.org/stevelacy/gulp-stylus)
[![NPM version](https://badge.fury.io/js/gulp-stylus.png)](http://badge.fury.io/js/gulp-stylus)

> Compile [Stylus](http://learnboost.github.io/stylus/) with gulp (gulpjs.com)

## Information

<table>
<tr>
<td>Package</td><td>gulp-stylus</td>
</tr>
<tr>
<td>Description</td>
<td>Stylus plugin for gulp</td>
</tr>
<tr>
<td>Node Version</td>
<td>>= 0.9</td>
</tr>
<tr>
<td>Gulp Version</td>
<td>>= 3.x</td>
</tr>
</table>

## Usage

#### Install

```sh
$ npm install --save-dev gulp-stylus
```

## Examples

```javascript

// include the required packages.
var gulp = require('gulp');
var data = require('gulp-data');
var stylus = require('gulp-stylus');


// include, if you want to work with sourcemaps
var sourcemaps = require('gulp-sourcemaps');

// Get one .styl file and render
gulp.task('one', function () {
  return gulp.src('./css/one.styl')
    .pipe(stylus())
    .pipe(gulp.dest('./css/build'));
});

// Options
// Options compress
gulp.task('compress', function () {
  return gulp.src('./css/compressed.styl')
    .pipe(stylus({
      compress: true
    }))
    .pipe(gulp.dest('./css/build'));
});


// Set linenos
gulp.task('linenos', function () {
  return gulp.src('./css/linenos.styl')
    .pipe(stylus({linenos: true}))
    .pipe(gulp.dest('./css/build'));
});

// Include css
// Stylus has an awkward and perplexing 'include css' option
gulp.task('include-css', function() {
  return gulp.src('./css/*.styl')
    .pipe(stylus({
      'include css': true
    }))
    .pipe(gulp.dest('./'));

});

// Inline sourcemaps
gulp.task('sourcemaps-inline', function () {
  return gulp.src('./css/sourcemaps-inline.styl')
    .pipe(sourcemaps.init())
    .pipe(stylus())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('./css/build'));
});

// External sourcemaps
gulp.task('sourcemaps-external', function () {
  return gulp.src('./css/sourcemaps-external.styl')
    .pipe(sourcemaps.init())
    .pipe(stylus())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('./css/build'));
});

// Pass an object in raw form to be accessable in stylus
var data = {red: '#ff0000'};
gulp.task('pass-object', function () {
  gulp.src('./sty/main.styl')
    .pipe(stylus({ rawDefine: { data: data }}))
    .pipe(gulp.dest('./css/build'));
});

// Use with gulp-data
gulp.task('gulp-data', function() {
  gulp.src('./components/**/*.styl')
    .pipe(data(function(file){
      return {
        componentPath: '/' + (file.path.replace(file.base, '').replace(/\/[^\/]*$/, ''))
      };
    }))
    .pipe(stylus())
    .pipe(gulp.dest('./css/build'));
});

/* Ex:
body
  color: data.red;
*/

// Default gulp task to run
gulp.task('default', ['one', 'compress', 'linenos', 'sourcemaps-inline', 'sourcemaps-external', 'pass-object']);

```

##### You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-stylus/tree/master/examples)

## Extras
You can access the original `stylus` module that `gulp-stylus` uses.
```
var originalStylus = require('gulp-stylus').stylus;
```

## Options
#### All stylus options are passed to [accord/stylus](https://github.com/jenius/accord/blob/master/docs/stylus.md)



## LICENSE [MIT](LICENSE)

---
_Source: https://npm.io/package/gulp-stylus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
