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

coffee-stylesheets

v0.0.5

Published

Transpiler similar to SASS/SCSS/LESS/Stylus, except its 100% CoffeeScript!

Downloads

7

Readme

What if you could write CoffeeScript like:

engine = new CoffeeStylesheets
 format: true
 globals:
   px: (i) -> i + 'px'
   # this is like a nib/compass cross-browser helper
   border_radius: (s)-> @literal """
     -moz-border-radius: #{s}; /* Firefox */
       -webkit-border-radius: #{s}; /* Safari, Chrome */
       border-radius: #{s}; /* CSS3 */
   """

stylesheet = ->
  body ->
    background 'black'
    color 'red'
    p ->
      font_size '12px'
      border_radius px 5

console.log css = engine.render stylesheet

and get back a CSS3 stylesheet, like:

body {
  background: black;
  color: red;
}
body p {
  font-size: 12px;
  -moz-border-radius: 5px; /* Firefox */
  -webkit-border-radius: 5px; /* Safari, Chrome */
  border-radius: 5px; /* CSS3 */
}

Now, you can!

Why this monstrosity?

# * in the end it compiles to pure-js concatenation. no string parsing necessary
# * no engine (like sass or stylus) is required to render data through the templates
# * template compilation is like 90% faster than stylus
# * it eliminates potential complexities of double-trees between server-side and client-side templating engines and templates
# * stand-alone; no dependencies
# * only one language to write; one language to teach/master; one language to rule them all!
# * common functions available to node/js/coffee also available in templates i.e. require() and executed in same scope
# * its eliminating all the intermediary steps between the initial precompilation syntax sugar and the end result
#   i see this as the simplification of stylus + mincer + coffeecup
#   they could all be MUCH smaller, faster, and simpler as one solution or separate parts
#     (i.e.,
#
#       javascript engine compiles .styl files to .css markup (slowly)
#       gaze generates css sprite images (speed depends on stylus)
#       gaze aggregates .css, minifies, gzips it (speed depends on stylus)
#
#       vs.
#
#       coffee engine compiles .coffee files to a single application.css file (fast!)
#         and at the same time, (optionall) generates css sprite images with presence of coffee-sprites lib
#         and at the same time, minifies, and gzips it
#     )
#
# there's not as much room for economy in this example but it would all be faster
# simply if stylus was faster. it all hinges on stylus in a potentially bad way
#
# cons are:
# * the potentially ugly initial template language
# * may be less interesting to write than pure css of the end output which is more understandable, but repetitive
# * in the end, going to great lengths to avoid manually closing brackets and semi-colons and memorizing cross-browser css hacks