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

aurajss

v1.2.2

Published

AuraJSS allows for the creation of CSS Stylesheets with Javascript/Typescript.

Downloads

15

Readme

AuraJSS - Styling with JavaScript made easy

Note: AuraJSS is still in active development. 
Some things may not work as expected and may change at any point.
WARNING: V1.1 introduces a breaking change to UnitValue. `unit` now is `u`, and `value` is `v`.

AuraJSS is a library that allows you to create fully fledged stylesheets using Javascript. With a high focus on being dynamic, you can choose to compile to file, or to do it on the fly!

But why?

Honestly, it started out as a small little fun project. This quickly became more serious though and is now being developed to be extremely usable and fast!

Quickstart

First, you will need to install AuraJSS from NPM.

npm i aurajss --save-dev //If you only use it to compile to file
npm i aurajss // If you also want to compile on the fly.

With this quickstart we will use Typescript, but regular JS will obviously work as well.

Creating a Stylesheet

For AuraJSS to function you need to create a new Stylesheet.

import { StyleSheet } from 'aurajss';

export default new Stylesheet{[]}

Styling basics

An empty stylesheet is not exactly useful, so let's add some styles!

import { StyleSheet, selector, backgroundColor, RGB } from 'aurajss';

export default new Stylesheet{[
    selector('body',[
        backgroundColor(new RGB(10,10,10))
    ])
]};

Above we have added a selector which will select the body element. Then, we apply a background color to it using a new RGB value. Note: You can choose to import each function from aurajss (an import with each one is below) or add them to a namespace with import * as aurajss from 'aurajss'.

Compiling a Stylesheet

Okay, so we have a Stylesheet with some styles. Time to compile it to CSS! You can do this in the same file, or create a new file. For this example we will use the same one.

import { StyleSheet, selector, backgroundColor, RGB, compile } from 'aurajss';

// We replace the export with a const so it can be used in the compile function.
const sheet = new Stylesheet{[
    selector('body',[
        backgroundColor(new RGB(10,10,10))
    ])
]};

compile({
    input: sheet,
    outpath: './aurajss.css',
});

Now, if you run your script, it will start compiling the Stylesheet into CSS and (if everything goes correct) a new file will be created with the name present in output. You can disable writing to file by not providing an output path.

compile also returns a string containing the compiled CSS, so you can use that for something if you want to (ex. On the fly compilation).

Resources

Contributing

We are open to your contributions! Please make sure you keep to the same style we use (eslint config coming soon) and that you test your code before submitting a PR. Additionally, make sure it is properly documented.

Setting up for contribution

Setup up for contribution is extremely simple, as we have 0 (direct) dependencies. However, to actually run your code having typescript installed globally is a good idea. You can do this with npm i -g typescript.

After that, just run tsc in the root of the project and you are good to go!

Credits

Developed by ATHER. Project is lead by Saltylelele.