npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-cssql

v1.0.2

Published

Javascript wrapper for the CSS in SQL Transpiler

Downloads

10

Readme

node-cssql

This library cuts through the javascript/css debate by providing a forbidden third option: css in sql! Through the use of a SQL DDL-like syntax users are able to style files which are then transpiled in CSS. The transpiler is written in haskell, but is made more usefully available by being distribution in javascript through the use ghcjs.

Q: I've heard that CSS often falls in the write-once-read-never mode of software, does this help to address that? A: No, in fact it actually makes the problem worse by making the syntax more verbose and hence more difficult to read.

Q: Is this good for anything? A: .... it could be ?????????

Node API

You can install the library inside of a node project by running:

npm install node-cssql

You can then use it like:

const {cssql} = require('node-cssql');

cssql('./test/tests/join.cssql', './test/tests/join.css');

Functions

CREATE SELECTOR <SELECTOR>; Creates a selector table

CREATE VARIABLE $KEY <VALUE>; Creates a css variable

INSERT <SELECTOR> (<CSS_KEY>, <CSS_VALUE>); Insert an attribute into a table

DELETE <SELECTOR> <CSS_KEY>; Remove attribute from a table

DROP <SELECTOR>; Remove table from the database

COPY <SELECTOR> AS <SELECTOR>; Copy a table as another table, old table still exists.

RENAME <SELECTOR> AS <SELECTOR>; RENAME <SELECTOR> AS <INNERMOST SELECTOR> IN ... IN <OUTERMOST SELECTOR>; Rename a table

MERGE <SELECTOR> AND <SELECTOR> AND ... AND <SELECTOR> AS <NEW SELECTOR>; Combine the attributes of a collection of selectors, order of input selectors determines resulting attribute table

NEST <SELECTOR> INTO <SELECTOR>; NEST <SELECTOR> INTO <INNERMOST SELECTOR> IN ... IN <OUTERMOST SELECTOR>; Destructively move a table into another table

Syntax Example

What does this wacky language actually look like? Well,


CREATE SELECTOR .margin-huge-top;
INSERT .margin-huge-top (margin-top, 50px);

CREATE SELECTOR .margin-huge-bottom;
INSERT .margin-huge-bottom (margin-bottom, 50px);

CREATE SELECTOR .margin-huge-left;
INSERT .margin-huge-left (margin-left, 50px);

CREATE SELECTOR .margin-huge-right;
INSERT .margin-huge-right (margin-right, 50px);

MERGE .margin-huge-top AND .margin-huge-bottom AND .margin-huge-left AND .margin-huge-right AS .margin-huge;

DROP .margin-huge-left;

Which will yield css like

.margin-huge-top {
  margin-top: 50px;
}
.margin-huge-bottom {
  margin-bottom: 50px;
}
.margin-huge-right {
  margin-right: 50px;
}
.margin-huge {
  margin-bottom: 50px;
  margin-left: 50px;
  margin-right: 50px;
  margin-top: 50px;
}

You can check out more little examples in the tests folder.