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

@y-fe/mixin

v0.0.1

Published

CSS Preprocessor Mixin library

Downloads

4

Readme

y-mixin

这是什么?

y-mixin 是来自阅文前端团队的 CSS 预处理器 mixin 库。

如何使用?

$ npm i @_y/mixin
@import "@_y/mixin";

/* css reset */
#reset;

/* atomic css */
#acss;

/* layout css */
#layout;

我们默认是采用less的方式引入。

@import "@_y/mixin/scss/_mixin.scss";

/* css reset */
@include reset;

/* atomic css */
@include acss;

/* css reset */
@include layout;

Sass 的版本需要自己添加完整路径。

Api

| mixin名字 | 参数 | notes | |:--|:--|:--| |reset| - | CSS reset | |acss| - | Atomic css | |layout| - | 常用的布局样式 | |margins| [数字列表,单位:px] | 基于列表生成4个方向的外间距 | |paddings| [数字列表,单位:px] | 基于列表生成4个方向的内间距 | |lineHeighs| [数字列表,单位:px] | 基于列表行高列表 | |fontSizes| [数字列表,单位:px] | 基于列表生成字号列表 |

以下方法需要内嵌到选择器中使用。

.clearfix{
    #clearfix;
}
.clearfix{
    @include clearfix;
}

| mixin名字 | 参数 | 简介 | |:--|:--|:--| |clearfix| - | 清除浮动 | |ell| - | 单行文本点点点 | |ells| [行数:2,行高:null ] | 多行文本显示点点点 |

Api layout

layout 里罗列了几常用的一些方法,有待商榷。

| class名字 | 简介 | |:--|:--| |.clearfix| 清除浮动 | |.ell| 单行文本点点点 | |.i | icon 图标基础类 | |.trans | 200ms transition 动画 | |.pa_middle | 基于 position:absolute 上下居中(浏览器需要支持transform)| |.pa_center | 基于 position:absolute 左右居中(浏览器需要支持transform)| |.pa_auto | 基于 position:absolute 上下左右居中(浏览器需要支持transform)|

Api margins, paddings

px 为默认参数,如果想用rem,需要手动传入。

@marginsList: 8, 16;
#margins(@marginsList);
// #margins(@marginsList, rem);
@include margins((8, 16));
// @include margins((8, 16), rem);
.mt8 { margin-top: 8px; }
.mr8 { margin-right: 8px; }
.mb8 { margin-bottom: 8px; }
.ml8 { margin-left: 8px; }
.mt16 { margin-top: 16px; }
.mr16 { margin-right: 16px; }
.mb16 { margin-bottom: 16px; }
.ml16 { margin-left: 16px; }

paddings 逻辑和 margins 一样

Api lineHeighs, fontSizes

px 为默认参数,如果想用rem,需要手动传入。

/* 定义行高列表 */
@lineHeightList: 16, 20;
#lineHeights(@lineHeightList);
// #lineHeights(@lineHeightList, rem);

/* 定义字号列表 */
@fontSizeList: 12, 16;
#fontSizes(@fontSizeList);
// #fontSizes(@fontSizeList, rem);
/* 定义字号列表 */
@include fontSizes((16, 20));
// @include fontSizes((16, 20), rem);

/* 定义字行高列表 */
@include lineHeights((12, 16));
// @include lineHeights((12, 16), rem);
.fs12 { font-size: 12px; }
.fs16 { font-size: 16px; }

.lh16 { line-height: 16px; }
.lh20 { line-height: 20px; }