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 🙏

© 2024 – Pkg Stats / Ryan Hefner

dcss

v0.3.1

Published

Discore CSS

Downloads

17

Readme

Discore CSS

This is a CSS Preprocessor used for Discore / Funraise.me!, etc. It is less than 25 lines long!

var rework = require('rework')
var cssWhitespace = require('css-whitespace')
var variables = require('rework-variables')
var inherit = require('rework-inherit')
var moveMedia = require('rework-move-media')
var autoprefixer = require('autoprefixer')

module.exports = function (dcss, options) {
  options = options || {}

  var css = rework(cssWhitespace(dcss))
  .use(variables(options.variables || {}))
  .use(inherit())
  .use(autoprefixer.rework())
  .use(moveMedia(options.queries))

  // Browser support
  if (rework.inline && options.inline)
    css.use(rework.inline(options.inline));

  return css.toString()
}

Want to try it out? Here's a live demo that should work on modern browsers (IE9+) and its source code.

Why?

  • Have more power and control over your CSS preprocessor
  • Add and remove features you want and don't want
  • Have the features you want work the way you want it. For me, Stylus' @extends didn't work the way I wanted it to, so I made my own.

I don't use most of any CSS preprocessors features, many of which just create problems. For example, I don't believe in logic in your CSS, but if you do need it, it should be in Javascript which you already know and love, not some new CSS preprocessor language.

rework makes creating your own CSS preprocessor easy. It parses your CSS file. You then pass in any function you'd like to "rework" your CSS. It then stringifies your CSS. That's all.

Middleware

Don't like the feature? Fork it and change your dependency. Want more? Add more! Each are small, making maintaining a fork relatively easy. Keeping modules small is the node.js way!

For more information on each middleware, just look at the link provided (if available). Each of these middleware can be considered the specifications and the documentation.

css-whitespace

Allows you to write your code without {} or ;s like in Stylus. Also supports nesting, although I don't believe in it.

rework-variables

Pass in an object of variables. Refer to these variables in your CSS with a $ prefix.

rework-inherit

This allows you to inherit one selector to another. This will literally inherit every single rule referenced by the selector you are inheriting. It also allows "placeholders".

rework-move-media

Consolidates your media queries, sorts them by a list of queries, then moves them to the end of your CSS file.

Notes

We use the .styl extension for Stylus for the syntax highlighting.

Compatibility

IE9+, though browser support is really only for the sake of the demo.

License

WTFPL