Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-css-usage

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-css-usage

A Gulp task which scans your JavaScript classes, including React JSX files support (.jsx/.js), your CSS files, and gives you a report of CSS coverage. i.e how many class names are needless and which are those class names.

  • 1.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-55.56%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-css-usage

A Gulp task which scans your JavaScript classes, including React JSX files support ( .jsx / .js ), your CSS files, and gives you a report of CSS coverage.
.i.e how many class names are needless and which are those class names.

In this way, you can tremendously accelerate the rendering time of your app by reducing network latency, loading and parsing time, as the CSS file is smaller with less properties to process and etc.

Install

npm install gulp-css-usage --save-dev

Usage

include the plug-in
// ECMAScript 5 code, using require()
var gulp = require('gulp');
var cssusage = require('gulp-css-usage').default;
// ECMAScript 6 code, using module import
import gulp from 'gulp';
import gulpCssUsage from 'gulp-css-usage';
using the plug-in
gulp.task('check-css-usage', function () {
  return gulp.src('/.../path/to/your/jsx/files/**/*.{jsx,js}')
    .pipe(gulpCssUsage({css: '/.../path/to/your/css/file/style.css', babylon:[]}));
});

options

css

mandatory Type: String

The file path to the CSS file which this plug-in will test.
Note: at the moment, supports only one CSS file so it is prefer to give here the compiled/concatenated styling file)

babylon

Type: Array:String Default: ['jsx', 'flow', 'classProperties']

Array containing the plugins that you want to enable.
Since we're using babel 6.4+ and babylon to parse and extract the class names from the jsx files, you might need to add which plug-ins to enable to parse your code if you're using more ES6 or ES7 features.

Example: if you're using objectRestSpread capability which is not in ECMAScript2015 standards - you'll need to add it

For more available plug-ins, go to babel-babylon

Having some trouble? Have an issue?

For bugs and issues, please use the Issues page.

For trouble in usage or unclear stuff, please use the awesome StackOverflow and tag your question with gulp-css-usage, as well as other tags as you see fit

Road map

  • write results to file
  • support of more CSS selectors
  • support multiple CSS files
  • support of precompiled SCSS files as well

Contribute

Sure! just fork this repository and join in!

Keywords

FAQs

Package last updated on 28 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc