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

@oawu/scss

v1.0.24

Published

📝 看我把 scss 變成 css!

Downloads

12

Readme

OA's Node scss 轉換工具

OA's Node scss 轉換工具 📝

說明

基於 npm 上的 sass 開發的應用工具,同時加入些許 compass 相關的 mixinfunction 以便於使用。

安裝

npm install @oawu/scss

使用

引入 require('@oawu/scss') 即可使用 scss 功能,如下範例:


  const SCSS = require('@oawu/scss')

  SCSS.file('/paths.../some.scss', (error, result) => {
    // done..
  })

  // or
  SCSS.data('$w: 100px; div { width: $w; }', (error, result) => {
    // done..
  })

其他功能

可以使用 @import "@"; 來使用此套件的相關功能,其參考目錄為 Libs

  @import "@";

  * {
    &, &:after, &:before {
      vertical-align: top;
      @include box-sizing(border-box);
      @include font-smoothing(subpixel-antialiased);
    }
  }

若要使用 Libs 下的其他功能,例如 CSS3/Cursor 內所有功能與 CSS3/Font/Face.scss,使用方式如下:


  @import "@/CSS3/Cursor";
  @import "@/CSS3/Font/Face";

特殊功能

可以使用 @import "*";@import "Lalilo"; 來快速使用 Lalilo 框架常用功能,其引入的功能可以參考 Lalilo.scss 此檔案。

  @import "*";

  * {
    &, &:after, &:before {
      vertical-align: top;
      @include box-sizing(border-box);
      @include font-smoothing(subpixel-antialiased);
    }
  }

由於 @import "Lalilo"; 為直接指定的快取檔案,主要目的是為了加快編譯速度,當然您可以自定義引入的檔案內容。

預設的快取檔案為 Lalilo.scss,但可以使用 Scss.contents 來改變快取檔案內容。

以下範例為改變 @import "Lalilo"; 後所引入的內容:

  const SCSS = require('@oawu/scss')
  SCSS.contents = "%-tmp {}"
  @import "Lalilo";

  div {
    @extend %-tmp;
  }

自動編譯

資料結構如下,其實可以使用 watch.js 來自動編譯 scss 檔案。

project/
  + css/
  + scss/
    + index.scss
  + watch.js
  // index.scss
  @import "*";

  a {
    @include border-radius(10px);
    background-color: rgba(0, 0, 255, 0.2);
    border: 1px solid rgba(255, 0, 0, .3);
  }
  // watch.js
  const { watch } = require('@oawu/scss')

  watch
    .scssDir('scss')
    .cssDir('css')
    .start()

終端在 專案目錄 下,執行 node watch.js 即可啟動自動編譯。

scssDircssDir 兩個目錄可以擺放與 watch.js 相對的路徑目錄,亦可擺放絕對目錄。

參考