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

fela-plugin-validator

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-validator

Fela plugin to validate style objects

  • 4.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6K
decreased by-18.68%
Maintainers
1
Weekly downloads
 
Created
Source

fela-plugin-validator

npm downloads gzipped size

Enforces object validation for keyframes and rules. Logs invalid properties to the console. One might also enable automatic property deletion.

Installation

npm i --save fela-plugin-validator

Assuming you are using npm as your package manager you can just npm install.
Otherwise we also provide a UMD. You can easily use it via unpkg. It registers a FelaPluginValidator global.

<!-- Fela (Development): Unminified version including all warnings -->
<script src="https://unpkg.com/fela-plugin-validator@4.2.5/dist/fela-plugin-validator.js"></script>
<!-- Fela (Production): Minified version -->
<script src="https://unpkg.com/fela-plugin-validator@4.2.5/dist/fela-plugin-validator.min.js"></script>

Usage

Make sure to read the documentation on how to use plugins.

import { createRenderer } from 'fela'
import validator from 'fela-plugin-validator'

const renderer = createRenderer({
  plugins: [ validator() ]
})

Configuration

Options
 OptionValueDefaultDescription
logInvalid(boolean) truelogs invalid properties/values
deleteInvalid(boolean) falsedeletes invalid properties/values
Example
import { createRenderer } from 'fela'
import validator from 'fela-plugin-validator'

const validatorPlugin = validator({
  logInvalid: true,
  deleteInvalid: true
})

const renderer = createRenderer({
  plugins: [ validatorPlugin ]
})

Example

If the deleteInvalid option is enabled.

Keyframe

Input
{
  '0%': {
    color: 'red'
  },
  '101%': {
    color: 'blue'
  },
  color: 'blue'
}
Output
{
  '0%': {
    color: 'red'
  }
}

Rule

Input
{
  color: 'red',
  ':hover': {
    color: 'green',
    foo: {
      color: 'blue'
    }
  },
  'nested': {
    color: 'yellow'
  }
}
Output
{
  color: 'red',
  ':hover': {
    color: 'green',
  }
}

License

Fela is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with ♥ by @rofrischmann and all the great contributors.

Keywords

FAQs

Package last updated on 17 Feb 2017

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