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

vue-aspect-ratio

v0.1.1

Published

![screenshot](https://raw.githubusercontent.com/albertodeago/vue-aspect-ratio/master/assets/screen.png)

Downloads

611

Readme

screenshot

vue-aspect-ratio

A component to render a certain aspect ratio element.
It exposes a default slot that will have the desided ratio.
Weights 3.8kb not gzipped.

How to install and use

To install the package in your application just type

npm install vue-aspect-ratio

Then, to install as a global component

import Vue from "vue";
import VueAspectRatio from "vue-aspect-ratio";

Vue.component("vue-aspect-ratio", VueAspectRatio)

Or you can register locally in one of your components as follows

import VueAspectRatio from "vue-aspect-ratio";

export default {
    name: "AmazingComponent",
    props: [myprop],
    components: {
        "vue-aspect-ratio": VueAspectRatio
    }
}

Using in templates

<div class="my-container">
    <vue-aspect-ratio ar="16:9" width="640px">
        <div>your content goes here</div>
    </vue-aspect-ratio>
</div>

NOTE: You may need to set in css "height: 100%" on your content that goes inside vue-aspect-ratio to fill the entire space if your content is not long enough.

Parameters and events

Component props:

| Name | Type | Mandatory | Example | Description | |--------|--------|-----------|---------|------------------| | ar | String | false | "16:9" | the aspect ratio | | width | String | false | "640px" | the css value of the width to set on the element |

It does not emit any event

Contributing

The project is opened to contributes, suggestions and improvements. You can use the Issues section.

Project setup

Fork the project, open it up and type

npm install

To run the example page, it will open a dev server listening to localhost:8080 (usually), type:

npm run dev

To build for production

npm run build

To lint the project

npm run lint

To prepare for pubblication

npm run prepublish

Test

The project uses Cypress If you want to open the interactive cypress dashboard to run and check tests

npm run test:open

If you instead just want to run the tests in headless mode

npm run test

Note: tests required dev server to be up and running

Author and License

Alberto De Agostini

Licensed under MIT