Js For Css
Write CSS selectors using javascript!
This project is currently in development stage. I'm looking for collaborators :) Any type of help is very much appreciated.
Sample
Write Javascript
const selector = ; selector ; selector ; selector ;
Output CSS
Install
NPM
npm install js-for-css --save
YARN
yarn add js-for-css
Usage
; const selector = ; // do your stuff
API
Methods
.create(type, name)
.create()
methods is required to create a css selector. This method receives 2 required parameters, type
and name
. type
is the selector type, e.g. classes, ids, tags etc. name
is the selector type name, e.g. btn
, btn-primary
, div
, p
, h1
etc.
Available types | Ouput |
---|---|
class |
.[class name] {} |
class:active |
.[class name]:active {} |
class:focus |
.[class name]:focus {} |
class:hover |
.[class name]:hover {} |
tag |
.[html tag] {} |
tag:active |
.[html tag]:active {} |
tag:focus |
.[html tag]:focus {} |
tag:hover |
.[html tag]:hover {} |
.addProps(property, value)
As the name suggests, this method adds a css property to the selector you created e.g. background
, font-size
, color
, height
, width
etc...
.build()
This method is required to build each selector. This must be invoked at the end of every selector invocation.