Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

script-style

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

script-style

Intelligent JS-powered alternative to pure CSS, using JSON objects to dynamically set properties.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Script-Style

CSS, but not quite. Intelligent JS-powered alternative to pure CSS, using JSON objects to dynamically set properties.

Examples

Instead of:

h1{
  font-family: sans-serif;
  font-size: 3rem;
  color: rgb(0, 0, 0);
}
p{
  font-family: sans-serif;
  font-size: 1rem;
  color: rgb(76, 76, 76);
}

Script-Style lets you do:

var scriptstyle = new ScriptStyle();
scriptstyle.render([
  {
    selector:"h1",
    rules:{
      fontFamily: "sans-serif",
      fontSize: "3rem",
      color: "rgb(0, 0, 0)"
    }
  }
]);
scriptstyle.render([
  {
    selector:"p",
    rules:{
      fontFamily: scriptstyle.Computed("h1","font-family").value, //Set font-family to computed font-family for first h1
      fontSize: scriptstyle.Style("h1","font-size").UnitChange("rem",-2), //Set font-size to 2 less than DOM font-size for h1s
      color: scriptstyle.Computed("h1","color").ColorChange(+30) //30% more than computed colour for h1
    }
  }
]);

Documentation

You can find Script-Style on readthedocs.io: Documentation

Keywords

javascript

FAQs

Package last updated on 11 Mar 2018

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