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

@themexpert/assets-helper

v1.0.2

Published

Assets Helper, a Javascript Assets Helper library

Downloads

3

Readme

Assets Helper

HTML Markup

    <div id="alert">
        <p>
            Lorem ipsum dolor sit amet consectetur, adipisicing elit. Porro debitis odio nisi. Odit eligendi necessitatibus maxime ab deleniti in voluptatem, obcaecati exercitationem ducimus adipisci soluta hic laboriosam dolorem animi. Facere.
        </p>
    </div>

Creating CSS Rules


    /////////////////////////////////////////////////////////
    //
    // Loading Alert element assets
    //
    /////////////////////////////////////////////////////////
    var AlertAssets = Object.assign({}, Assets);

    // desktop rules
    AlertAssets.desktop("#alert", "background: red; color: white; padding: 100px;");

    // tablet rules
    AlertAssets.tablet("#alert", "background: green; color: white; padding: 50px;");

    // phone rules
    AlertAssets.phone("#alert", "background: black; color: white; padding: 20px;");

    // responsive margin rules
    AlertAssets.margin("#alert", {
        top: 10, bottom: 20, right: 10, left: 15, // desktop
        responsive: true, // want responsive
        tablet: {
            top: 10, bottom: 20, right: 10, left: 15 // tablet
        },
        phone: {
            top: 10, bottom: 20, right: 10, left: 15 // phone
        }
    })

    // responsive padding rules
    AlertAssets.padding("#alert", {
        top: 10, bottom: 20, right: 10, left: 15, // desktop
        responsive: true, // want responsive
        tablet: {
            top: 10, bottom: 20, right: 10, left: 15 // tablet
        },
        phone: {
            top: 10, bottom: 20, right: 10, left: 15 // phone
        }
    })

    // width prop
    AlertAssets.width('#alert', {
        desktop: 20,
        responsive: true,
        tablet: 10,
        phone: 18
    })

    // height prop
    AlertAssets.height('#alert', {
        desktop: 20,
        responsive: true,
        tablet: 10,
        phone: 18
    })

    // alternative height prop
    Assets.height("#alert", 20)

    // font weight
    AlertAssets.fontWeight('#alert', 'regular')

    // font size
    AlertAssets.fontSize("#alert", {
        desktop: 20,
        responsive: true,
        tablet: 90,
        phone: 80
    })

    // line height
    AlertAssets.lineHeight("#alert", {
        desktop: 10,
        responsive: true,
        tablet: 8,
        phone: 5
    })

    // text alignment
    AlertAssets.alignment("#alert", {
        desktop: "left",
        responsive: true,
        tablet: "right",
        phone: "center"
    })

    // setting float value ( with responsive )
    AlertAssets.float("#alert", {
        desktop: "left",
        responsive: true,
        tablet: "right",
        phone: "right"
    })

    // setting float value ( without responsive )
    AlertAssets.float("#alert", "left")

    // setting hover box shadow
    AlertAssets.hoverBoxShadow("#alert", {
        hover_shadow_horizontal: 10,
        hover_shadow_vertical: 20,
        hover_shadow_vertical: 30,
        hover_shadow_blur: 40,
        hover_shadow_spread: 50,
        hover_shadow_color: "blue",
        hover_scale_enabled: true,
        hover_shadow_scale: "1.5, 1.5"
    })

    // getting hover box shadow css rules
    AlertAssets.getHoverBoxShadow({
        hover_shadow_horizontal: 10,
        hover_shadow_vertical: 20,
        hover_shadow_vertical: 30,
        hover_shadow_blur: 40,
        hover_shadow_spread: 50,
        hover_shadow_color: "blue",
        hover_scale_enabled: true,
        hover_shadow_scale: "1.5, 1.5"
    })

    // typography
    AlertAssets.typography("#alert", {
        family: "arial", // required
        size: 20,
        weight: '100italic',
        height: 2,
        case:  'uppercase'
    })

    // getting image url
    AlertAssets.image("images/info.png")

    // loading alert assets
    AlertAssets.load();

Template

    <!-- alert preivew ( showing alert template rendering ) -->
    <div id="alert-preview"></div>

    <!-- alert template -->
    <QuixTemplate id="alert-template">
        
        <style>
            body {
                background: white
            }
        </style>

        <QuixStyle>
             // loading css ( JS WAY )
            var alert = Object.assign({}, Assets); 
            alert.desktop("#alert-2", "background: {{ color }}");
        </QuixStyle>

        <QuixHtml>
            <div id="alerts">
                <!-- you can use twig sytax -->
                {% for alert in alerts %}
                    <div id="{{ alert }}">
                        <p>{{ alert }}</p>
                    </div>
                {% endfor %}
            </div>
        </QuixHtml>

        <QuixScript dependencies="
            http://example.com/js/foo.js,
            http://example.com/js/bar.js
        ">
            // you have access jQuery and lodash :) 
            // $("#alert-1").html("updated element")
        </QuixScript>

    </QuixTemplate>
    // rendering template
    AlertAssets.render("#alert-template", {
        alerts: ["alert-1", "alert-2"]
    }, "#alert-preview");

License

This library is licensed under the MIT License