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

foundation-stylus

v0.9.1

Published

Stylus plugin for foundation

Downloads

5

Readme

Foundation stylus plugin

What?

This is not a complete port of foundation 5 for stylus. For the specific reason that maintaining complete ports is painful, and so they get out of date.

This is:

  • An easy way to import foundation into a new stylus project.
  • Reformatting of the compiled foundation css so it can be imported into stylus as-is. This allows you to transparently use @extend .small-4 in your css for prototyping quickly, without messing up your html.
  • Exposes some helper mixins to make that easier.

Installation

  • Use stylizer
  • npm install foundation-stylus
  • Add 'foundation-stylus' to list of stylizer/stylus plugins.
  • Add @import 'foundation' to your main stylus file, e.g. app.styl.

Usage

With @extend

The simplest way to use this is with stylus's @extend function. This allows you to name your rows/columns/buttons/modules/etc semantically, and then extend them in css, just look at the foundation docs to know what classes you need to use.

E.g. for a three-column layout, you might have:

<section class='app-main'>
    <nav class='main-navigation'>
        ...
    </nav>

    <div class='main-content'>
    </div>

    <div class='chat'>
    </div>
</section>
@import 'foundation'

.app-main
    @extends .row

.main-navigation
    @extends .small-3
    @extends .large-2
    @extends .columns

.main-content
    @extends .small-7
    @extends .large-9
    @extends .columns

.chat
    @extends .small-2
    @extends .large-1
    @extends .columns

This keeps your html nice and clean, so that when you move from prototyping a layout -> production css, your UI/designer/team can refactor/rewrite most of the css, without having to remove all the stylus cruft.

With mixins

Using foundation-stylus as above means that we can integrate stylus and foundation without having to rewrite stylus into css (since stylus understands normal css). But the @extends syntax can get a bit verbose when adding multiple classes, as above. So we maintain a small list of extra mixins to make that process easier.

@import 'foundation'

.app-main
    grid-row

.main-navigation
    grid-columns(small: 3, large: 2)

.main-content
    grid-columns(small: 7, large: 9)

.chat
    grid-columns(small: 2, large: 1)

Mixin documentation

Grid

grid-row()

Equivalent to adding foundation's .row class:

.myapp
  grid-row

is equivalent to

<div class='myapp row'></div>

grid-columns(small, [medium], [large])

Helper for creating columns, with positional arguments. medium and large are optional. Aliased as grid-column if you prefer that.

.mycolumn
  grid-columns(2, 3, 4)

is equivalent to

<div class='mycolumn small-2 medium-3 large-4 columns'></div>

grid-columns(small: n, medium: n, large: n)

Helper for creating columns, with keyword arguments. You may specify any 1, 2 or all, arguments to create the relevant columns. Aliased as grid-column if you prefer that.

.mycolumn
  grid-columns(small: 4, large: 2)

is equivalent to

<div class='mycolumn small-2 large-4 columns'></div>

Contributing

I would love to support more things via (minimal mixins), pull requests are more than welcome for that.

Versioning

Versioning is tricky because I want to be able to track foundations updates (both minor and major), but also modify the actual api of this plugin if necessary, all while sticking closely to semver. My intention is to mark this as 1.0.0 when the public api for the plugin itself is stable, and then release minor/patch versions along with either mixin increments in this plugin, or minor/patch releases of foundation itself. If zurb 6 comes out, I suspect I'll bump everything here up to 2.0.0 and carry on from there.