npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-happiness-scss

v5.3.0

Published

gulp plugin for happiness-scss

Downloads

8

Readme

gulp-happiness-scss

npm es2015 license Dependencies Build Status

Gulp plugin for happiness-scss

js-happiness-style Happiness SCSS Style

Installing

npm install --save gulp-happiness-scss
# or using yarn cli
yarn add gulp-happiness-scss

Usage

Check out files with happiness-scss linter

const gulp = require('gulp');
const gulpHappinessScss = require('gulp-happiness-scss');

gulp.task('lint', function () {
	return gulp.src('./styles/**/*.scss')
		// Attaches the lint data to the "sassLint" property
		// of the file object so it can be used by other modules. 
		// By default it will skip files with empty content
		.pipe(gulpHappinessScss())
		
		// outputs the lint results to the console.
		.pipe(gulpHappinessScss.format())
		
		// Look after checking all the streamed files,
		// and if at least one of them has errors it will fail.
		// Note! This method does not transfer files further to the stream!
		.pipe(gulpHappinessScss.failAfterError());
});

Lint files and transfer, if had no problems

const gulp = require('gulp');
const gulpHappinessScss = require('gulp-happiness-scss');

gulp.task('lint', function () {
	return gulp.src('./styles/**/*.scss')
		.pipe(gulpHappinessScss())
		
		// Show in console happy files ;)
		.pipe(gulpHappinessScss.format({
			showHappyFiles: true
		}))
		
		// Failing if file has eslint errors,
		// it will break task immediately.
		// Current file and all next not will be transferred
		.pipe(gulpHappinessScss.failOnError())
		
		// transfer files
		.pipe(gulp.dest('./path/to/some/dir/'));
});

API

gulpHappinessScss()

No explicit configuration.
Linting with default options.
Attaches the lint data to the "sassLint" property of the file object so it can be used by other modules.

gulpHappinessScss(options)

options.linterOptions

type Object / default undefined
Here you can set all options for happiness-scsslinter.
See happiness-scss → Nodejs API → config for more information about notation and happiness-scss → CLI Options about their description.

options.noUnderscore

type boolean / default false
If set true - file which name starts with _ (underscore) will be skipped and not using in stream next.

You will receive message in console if it happens.
Example of log:

no-empty log example

options.noEmpty

type boolean / default true
File with empty content will be skipped and not using in stream next.
Note! Spaces, tabs and newlines will be treated as empty content.

You will receive message in console if it happens.
Example of log:

no-empty log example

options.silent

type boolean / default undefined
No logs about noEmpty and noUnderscore files

gulpHappiness.format()

No explicit configuration.
Outputs the lint results to the console.
Default formatter is stylish

gulpHappiness.format(config)

options.showHappyFiles

type boolean / default undefined
Show files without problems in console

Example of log from similar project gulp-happiness:

Show happy files example

options.noUnderscore

Same as gulpHappinessScss(options) → options.noUnderscore

options.noEmpty

Same as gulpHappinessScss(options) → options.noEmpty

options.silent

Same as gulpHappinessScss(options) → options.silent

options.linterOptions

Here you can set options happiness-scss > Nodejs API > config

gulpHappiness.failOnError()

No explicit configuration.

gulpHappiness.failOnError(options)

options.disabled

type boolean / default undefined
Not fail on errors

options.onEnd(errorMsg, sassLintData)

type fucnction / default undefined

Parameters:

Name | Data type | Description --- | --- | --- errorMsg | null/string | Is null if no errors were found and is string if errors were found. String contains a short message about errors sassLintData | Object | sass-lint data from file

Its call will be before ending of pipe. So you don't need apply no callbacks or return some values.
You can use it for own custom actions, e.g rewrite some globals.
Note! Even if options.disabled - is true - this function will be called

options.noUnderscore

Same as gulpHappinessScss(options) → options.noUnderscore

options.noEmpty

Same as gulpHappinessScss(options) → options.noEmpty

options.silent

Same as gulpHappinessScss(options) → options.silent

options.linterOptions

Here you can set options happiness-scss > Nodejs API > config

gulpHappiness.failAfterError()

No explicit configuration.

gulpHappiness.failAfterError(options)

options.disabled

Same as gulpHappiness.failOnError(options) → options.disabled

options.linterOptions

Here you can set options happiness-scss > Nodejs API > config


Rules

Please read happiness-scss / docs / Rules


Disabling Linters via Source

Please read Disabling Linters via Source


Tests

  1. npm test for testing js and scss code style
  2. npm run happiness-fix for automatically fix most of problems with js code style

Changelog

Please read CHANGELOG.md

Contributing

Please read CONTRIBUTING.md

Code of Conduct

Please read CODE_OF_CONDUCT.md