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

fashionista

v0.3.4

Published

Apply themes to connect/express apps using the Stylus port of Zurb Foundation themes

Downloads

29

Readme

fashionista Build Status

Apply customized themes to connect/express apps, based on the Stylus port of Zurb Foundation theme

Getting Started

fashionista comes with Foundation v4 loaded. To decorating your express app with Foundation. In your express app, add the following code:

var express = require('express');
var app = express();
var fashionista = require('fashionista');

fashionista().decorate(app);

And in your html code (note: fashionista requires either jQuery or Zepto's $ to work):

<html>
	<head>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/fashionista"></script>
  </head>
  <body>
  	<h1>your content ... </h1>
  </body>
</html>

more themes please

Of course, you don't want to stop here. fashionista allows you to load more than one theme at a time. Here's how:

var express = require('express');
var app = express();
var fashionista = require('fashionista');

fashionista([require('myTheme'), require('yourTheme')]).decorate(app);

When you have one or more themes loaded, the default foundation theme will be appended at the end of the list (if you manually included foundation in the list, the duplicated copy will not be appended). In any case (including when there is only foundation theme is loaded), the first in the list will be applied to your app. But you can easily switch the theme using what's fashionista's client support using javascript:

<html>
	<head>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/fashionista"></script>
    <script type="text/javascript">
    	$(document).ready(function() {
    		$('.myTheme').click(function() {
    			fashionista.use('myTheme');
    		})
    		$('.yourTheme').click(function() {
    			fashionista.use('yourTheme');
    		})
    	});
    </script>
  </head>
  <body>
  	<h1>your content ... </h1>
  	<button class='myTheme'>Apply myTheme</button>
  	<button class='yourTheme'>Apply yourTheme</button>
  </body>
</html>

In the above code, clicking each button will apply the named theme respectively.

more options please

As we see, integrating fashionista on html side is simply inserting the following line anywhere after your jQuery or Zepto:

<script type="text/javascript" src="/fashionista"></script>

In fact, all themes managed by fashionista (and any assets being consumed by these themes) will all be loaded under the root /fashionista. For example, the myTheme in the previous example is mounted at /fashionista/myTheme/myTheme.css. If, for any reason, you dislike fashionista to be part of your path, you can change it like so:

// in your express.js script
var express = require('express');
var app = express();
var fashionista = require('fashionista');

fashionista({
	themes: [require('myTheme'), require('yourTheme')],
	path: '/themes'
}).decorate(app);

Now your myTheme will be mounted at /themes/myTheme/myTheme.css after your integrate fashionista in html like so:

<script type="text/javascript" src="/themes"></script>

If you like to make your code look less clunky, the following code is equivalent to the above:

// in your express.js script
var express = require('express');
var app = express();
var Fashionista = require('fashionista');

var fashionista = new Fashionista({
	themes: [require('myTheme'), require('yourTheme')],
	path: '/themes'
});
fashionista.decorate(app);

creating fashionista-compatible customized Foundation theme

fashionista only serve the Stylus port of Foundation for now. With that in mind, your theme module should already be exporting a plugin function much like this one. All variables being exported in the stylus port of foundation.js is required for any custom theme that is intended to work with fashionista.

It would be much easier if you use generator-foundation to generate your custome theme module project.

examples (WIP)

License

Copyright (c) 2013 Brian Lai Licensed under the MIT license.

Release History