Giter Club home page Giter Club logo

gulp-stylus's Introduction

#gulp-stylus Build Status NPM version

Compile Stylus with gulp (gulpjs.com)

Information

Packagegulp-stylus
Description Stylus plugin for Gulp
Node Version >= 0.9
Gulp Version 3.x

Usage

Install

	npm install gulp-stylus --save

Examples

// Gulpfile.js
// Require the needed packages
var gulp = require('gulp');
var stylus = require('gulp-stylus');


// Get one .styl file and render
gulp.task('one', function () {
	gulp.src('./css/one.styl')
		.pipe(stylus({
			paths: ["/home/stylus-plugins/"], // only needed in special cases,
			set:['compress']
		}))
		.pipe(gulp.dest('./css'));
});


// Get all .styl files in one folder and render
gulp.task('one', function () {
	gulp.src('./css/blue/*.styl')
		.pipe(stylus())
		.pipe(gulp.dest('./css/blue'));
});



// Get and render all .styl files recursively
gulp.task('stylus', function () {
	gulp.src('./css/**/*.styl')
		.pipe(stylus())
		.pipe(gulp.dest('./css'));
});


// Stylus.use options:
// Use nib
gulp.task('nib', function () {
	gulp.src('./css/nib/*.styl')
		.pipe(stylus({use: ['nib']}))
		.pipe(gulp.dest('./css/'));
});

// Note: 'import:' is no longer needed when using 'use:['nib']' after 0.0.11
// nib usage
gulp.task('nib', function () {
	gulp.src('./css/nib/*.styl')
		.pipe(stylus({
			use: ['nib']}))
		.pipe(gulp.dest('./css/'));
});


// Stylus.set options:
// Option compress
gulp.task('compress', function () {
	gulp.src('./css/compressed/*.styl')
		.pipe(stylus({set:['compress']}))
		.pipe(gulp.dest('./css/compressed'));
});

// Option linenos
gulp.task('linenos', function () {
	gulp.src('./css/linenos/*.styl')
		.pipe(stylus({set:['linenos']}))
		.pipe(gulp.dest('./css/linenos'));
});

// Option "resolve url" (same as "--resolve-url" in CLI)
gulp.task('resolve-url', function () {
	gulp.src('./css/resolve/*.styl')
		.pipe(stylus({set:['resolve url']}))
		.pipe(gulp.dest('./css/resolved'));
});

// Option import file
gulp.task('import', function () {
	gulp.src('./css/test.styl')
		.pipe(stylus({import: ['./one.styl']})) // the file is Relative to the Other styl files
		.pipe(gulp.dest('./css/import'));
});

// Option urlFunc - inline images
gulp.task('urlfunc', function(){
	gulp.src('./css/urlfunc.styl')
	.pipe(stylus({urlFunc: ['inline-image']}))
	.pipe(gulp.dest('./css/urlfunc/'));
});

// Option define - define variables
gulp.task('define', function(){
	gulp.src('./css/define.styl')
	.pipe(stylus({define: {
		'ie8': true
	}}))
	.pipe(gulp.dest('./css/define/'));
});






// Default gulp task to run
gulp.task('default', ['stylus', 'one']);

####You can view more examples in the example folder.

API

stylus(options)

options.use

Type: Array Default: undefined

Array of string representing names of modules which will be used as extensions to Stylus (e.g. 'nib'). Modules are required inside of the plugin and invoked.

Options to the stylus stream are passed straight through to the stylus module.

Note: 'import:' is no longer needed when using 'use:['nib']' after 0.0.11 Example:

// stylus.use('nib')

.pipe(stylus({use: ['nib']}))

options.set

Type: Array Default: undefined

Example:

// stylus.set(['compress': true ]);
.pipe(stylus({set: ['compress']}))

// stylus.set(['linenos': true]);
.pipe(stylus({set: ['linenos']}))

options.import

Type: Array Default: undefined

Example:

// stylus.import(['./file.styl']);
.pipe(stylus({import:['./file.styl']}))

// stylus.import(['./css/*.css']);
.pipe(stylus({import:['./*.css']}))

LICENSE

(MIT License)

Copyright (c) 2013 Steve Lacy [email protected] - Fractal [email protected] wearefractal.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gulp-stylus's People

Contributors

kenany avatar msemenistyi avatar stephenlacy avatar stevelacy avatar th0r avatar wenqer avatar yocontra avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.