Socket
Socket
Sign inDemoInstall

css-selector-limit

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    css-selector-limit

Determine whether CSS files contain more selectors than IE's limit of 4095


Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Install size
1.60 MB
Created
Weekly downloads
 

Readme

Source

css-selector-limit

Node.js module for detecting if any CSS file in a set has more selectors than IE's limit of 4095.

Overview

Pass the module an array of CSS file paths and it will analyse each file and invoke a callback function that is passed an array of result objects in the same order of the original array.

There is a grunt and gulp plugin that wraps this module:

  • grunt plugin
  • gulp plugin
var cssSelectorLimit = require('css-selector-limit');

cssSelectorLimit([
	__dirname + '/style/default.css'
], function(err, results){
	if(err){
		//error occurred
	}
	else if(!results[0].ok){
		//number of selectors is over the limit.
	}
});

//pass options to function
cssSelectorLimit([
	__dirname + '/style/default.css'
], {
	limit: 10000
}, function(err, results){
	//do something with results.
});

//pass file contents directly
fs.readFile(__dirname + '/style/default.css', {encoding: 'utf-8'}, function(err, file){
	cssSelectorLimit([
		file
	], function(err, results){
		//do something with results.
	});
});

Options

options.limit

Type: Number Default value: 4095

Result Object

result.file

Type: String

Path to the file that was analysed.

result.ok

Type: Boolean

If the number of selectors is less than or equal to the limit the value will be true else false.

result.selector

Type: String Default value: null

The first selector that went over the limit.

result.line

Type: Number Default value: null

The line number of the first selector that went over the limit.

The first selector that went over the limit.

result.count

Type: Number

The total number of selectors in the file.

Keywords

FAQs

Last updated on 06 Jul 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc