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

microsass

v1.0.6

Published

simple scss to css in the web navigator

Downloads

361

Readme

Microsass GitHub license NPM version

Microsass is a script that can convert the basic structures of SCSS into CSS directly in the browser.

Microsass can process the staggered selectors of SCSS, and supports the declaration and use of basic variables, as well as the basic arithmetic processing of variables.

It also interprets the properties to add the -webkit, -moz-, -o and -ms required.

Testing and live example

https://bonarja.github.io/microsass 🔨⛏

Support

Microsass supports sass staggered selectors, the use of & (self selector), @media screen, @keyframes and @font-face.

Microsass allows to create variables using $size1: 300px; and basic arithmetic processes (addition, subtraction, multiplication and division)

.item {
    width: $size1 + $size2;
}

NOTE Microsass still can not interpret @media screen inside another 🙁

USE

Autoload

<head>
    <title>Microsass</title>
    <link sass="./main.scss" />
</head>
<body>
    <script src="./microsass.min.js"></script>
</body>

For multiple load you can separate using commas

<link
    sass="
    ./main.scss,
    .style.scss
"
/>

Autoload by Promise

Load by javaScript

<script src="./microsass.min.js"></script>
<script>
    microsass.import(["./main.scss", "./style.scss"]).then(() => {
        console.log("ready");
    });
</script>

Convert SCSS text

Convert micro sass string to css minify string

var scss = `
    $w1: 400px;
    $w2: 200px;
    #app {
        background: orange;
        .item{
            width: $w1 + $w2;
            p {
                color: white;
            }
        }
    }
`;
var css = microsass.convert(scss);

Convert micro sass string to css with format, html format and colors

var scss = `
    $w1: 400px;
    $w2: 200px;
    #app {
        background: orange;
        .item{
            width: $w1 + $w2;
            p {
                color: white;
            }
        }
    }
`;
var css = microsass.convert(scss, {
    format: true, // default is false
    html: true, // default is false, format is auto-set true when html is true
    color: true // default is true, only works when html is true
});

Convert by NPM module

npm install microsass -save

const microsass = require("microsass");

var css = microsass.convert(scss, {
    format: true, // default is false
    html: true, // default is false, format is auto-set true when html is true
    color: true // default is true, only works when html is true
});

Media abbreviation:

An abbreviation has been created for the media screen

Use:

@if x <= 400px {
    .item {
        width: 300px;
    }
}

Compiled output:

@media screen and (max-width: 400px) {
    .item {
        width: 300px;
    }
}

Cases:

@if x >= xx  ---->  @media screen and (min-width xx)
@if x <= xx  ---->  @media screen and (max-width xx)
@if y >= xx  ---->  @media screen and (min-height xx)
@if y <= xx  ---->  @media screen and (max-height xx)