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

absurd-css

v0.1.2

Published

Implementation of the CSS preprocessing of Absurd.js without dependencies and some changes

Downloads

8

Readme

Absurd-CSS

Overview

AbsurdJS CSS preprocessor only.

Installation

  npm i absurd-css

About

This is the CSS preprocessor part of the super power preprocessor AbsurdJS that contain some new features and changes and no dependencies needed. So, you could transform:

  • JavaScript, JSON, CSS to CSS

Usage

  var api = Absurd();
  api.add({
    body: {
      marginTop: "20px",
      p: {
        color: "#000"
      }
    }
  });
  api.compile(function(err, css) {
    // use the compiled css
  });

Features

  • Tiny and without cli usage.
  • Added scope method for scoped styles.
  • Added unmorph method to disable the morphs.
  • Refactored methods, plugins and molecules to a sigle files.
  • Support for custom delimiters in dynamic-css morph and value replacement in CSS.

Changes

  • compile method no longer accept a path as a parameter, just callback and options.
  • import, importCSS and rawImport no longer accept a path or path array as parameter, you must give it a content or array of contents.
  • In Webpack or Browserify environment, you can import CSS in CSS @import at-rule, with the corresponding loader or transformation. Otherwise is disabled.
  • Only jsonify and dynamic-css morph are avaliables.

Examples

Scoped style

  var api = Absurd();
  api.scope('#scope');
  api.add({
    body: {
      marginTop: "20px",
      p: {
        color: "#000"
      }
    }
  });
  api.compile(function(err, css) {
    console.log(css); // => #scope body{margin-top: 20px;}#scope body p{color: #000;}
  }, { minify: true });

Unmorph

  var api = Absurd();
  api.morph('jsonify');
  api.add({
    body: {
      marginTop: "20px",
      p: {
        color: "#000"
      }
    }
  });
  var rules = api.compile(); // => compile rules to a json
  var scope = { '#scope': rules }; // store json in a scope object
  api.unmorph().add(scope); // adding again as scope style
  api.compile(function(err, css) {
    console.log(css); // => #scope body{margin-top: 20px;}#scope body p{color: #000;}
  }, { minify: true });

Delimiters

  var api = Absurd();
  // this delimiters are the default, this is just an example.
  api.delimiters = ['{%', '%}'];
  api.define('someValue', '#765935');
  api.add({
    body: {
      marginTop: "20px",
      p: {
        color: "{% someValue %}"
      }
    }
  });
  api.compile(function(err, css) {
    console.log(css); // => body{margin-top: 20px;}body p{color: #765935;}
  }, { minify: true });

Tip for atoms

var api = Absurd();
  api.add({
    body: {
      marginTop: "20px",
      p: {
        // Atoms with properties that contain `()`
        // like url() you no need to put them, just put the value 
        bgi: "./path/to/some/image.png"
      }
    }
  });
  api.compile(function(err, css) {
    console.log(css); // => body{margin-top: 20px;}body p{background-image: url(./path/to/some/image.png);}
  }, { minify: true });

Official site, documentation

http://absurdjs.com/

Resources

  • AbsurdJS fundamentals - link
  • Writing your CSS with JavaScript - link
  • Componentizing the Web - link